The Applications of Matrices | What I wish my teachers told me way earlier

Zach Star
11 Oct 201925:15

Summary

TLDRThis video delves into the extensive applications of matrices in various fields, from electronics and image processing to computer graphics and network analysis. It explains how matrices can transform vectors, crucial for understanding systems in linear algebra. The script covers real-world uses such as solving complex systems of equations, analyzing population dynamics, and even aiding in criminal investigations through image enhancement. It also touches on the use of matrices in Google's PageRank algorithm, encryption methods, and their foundational role in machine learning and neural networks, demonstrating the profound impact of matrices in technology and security.

Takeaways

  • πŸ“š Matrices are fundamental in various fields such as circuit analysis, image processing, quantum mechanics, and computer graphics.
  • 🧩 Initially, matrices may seem boring due to their basic operations like addition and multiplication, which lack immediate context or excitement.
  • πŸ” Matrix multiplication with a vector can transform the vector through scaling and rotation, which is a key concept in linear algebra.
  • πŸŒ€ Special matrices like the identity matrix only rotate vectors, while others may only scale them, with eigenvectors being unaffected by rotation.
  • πŸ”‘ Matrices are used to solve systems of linear equations, where the coefficients and variables are organized into matrices for easier computation.
  • 🦠 The script uses a hypothetical zombie outbreak scenario to illustrate how matrices can model and predict the dynamics of a system over time.
  • πŸ” Image processing involves manipulating pixel values in an image, represented as matrices, to apply effects like blurring, sharpening, or edge detection.
  • 🌐 The adjacency matrix in graph theory represents connections between nodes and can be used to analyze complex networks like social connections or the web.
  • πŸ”‘ The power of an adjacency matrix can reveal paths of different lengths between nodes, and the trace of the matrix cube can indicate the presence of triangles in a network.
  • πŸ€– Applications of matrices extend to machine learning and neural networks, where they are crucial for the training and operation of algorithms.
  • πŸ”’ Historically, matrices have been used in encryption methods like the hill cipher, demonstrating their role in security.

Q & A

  • What are some fields where matrices are extremely important for understanding or analyzing different systems?

    -Matrices are used in fields such as image processing, computer graphics, quantum mechanics, the Google PageRank algorithm, and network analysis.

  • How do matrices transform vectors?

    -Matrices can scale and rotate vectors. When a vector is multiplied by a matrix, the resulting vector is a transformation of the original vector according to the matrix's properties.

  • What is an eigenvector and eigenvalue?

    -An eigenvector is a vector that, when multiplied by a matrix, only changes scale and not direction. The factor by which the vector is scaled is known as the eigenvalue.

  • How do matrices help solve systems of equations?

    -Matrices can be used to represent the coefficients and variables in a system of equations. By applying matrix multiplication, one can find the solution to the system, which corresponds to the input vector that results in a given output vector.

  • What is a Markov matrix and how is it used?

    -A Markov matrix is a matrix where each column sums to 1 and contains no negative values, representing probabilities of transitioning from one state to another. It's used to model systems that evolve over time, such as population dynamics.

  • How can matrices be used to analyze a zombie outbreak scenario?

    -In a zombie outbreak scenario, matrices can model the dynamics of human and zombie populations over time by representing the rates of infection and cure. By applying matrix multiplication iteratively, one can predict the long-term outcomes of the outbreak.

  • What is the Google PageRank algorithm and how does it relate to matrices?

    -The Google PageRank algorithm uses Markov matrices to rank websites. It treats outgoing links as probabilities of transitioning from one site to another, influencing the site's ranking based on the 'importance' of the sites it links to.

  • How are matrices used in image processing to blur an image?

    -In image processing, matrices can be used to blur an image by applying a kernel matrix over the image matrix. Each pixel in the resulting image is a weighted average of the pixels under the kernel, which smooths transitions between different colors.

  • How did law enforcement use matrices to identify an attacker in the Reginald Denny case?

    -In the Reginald Denny case, law enforcement used image processing techniques involving matrices to enhance the quality of live footage and identify a distinctive tattoo, which helped in securing a conviction.

  • What is an adjacency matrix and how is it used in network analysis?

    -An adjacency matrix is a matrix that represents a graph, where each row and column corresponds to a node, and the entries indicate the presence or absence of a connection between nodes. It's used to analyze networks by counting paths of different lengths between nodes.

  • How do matrices contribute to the field of machine learning and neural networks?

    -Matrices are fundamental in machine learning and neural networks for coding and manipulating data. They allow for efficient computation of linear transformations, which are essential operations in training and applying machine learning models.

Outlines

00:00

πŸ“š The Importance of Matrices in Various Fields

This paragraph introduces the wide-ranging applications of matrices in fields such as image processing, computer graphics, quantum mechanics, and network analysis. It discusses the initial perception of matrices as a boring math subject and contrasts this with their crucial role in real-world systems. The explanation begins with basic matrix operations and progresses to how matrices can transform vectors, highlighting the concept of eigenvalues and eigenvectors. The paragraph also touches on the use of matrices in solving systems of equations, illustrating the process with an example and mentioning the inverse matrix and its role in finding solutions.

05:00

πŸ§Ÿβ€β™‚οΈ Matrix Applications in Dynamic Systems: Zombie Outbreak Scenario

This section uses a hypothetical zombie outbreak scenario to demonstrate the application of matrices in analyzing dynamic systems that evolve over time. It describes a situation where humans and zombies are quarantined in a school with specific rates of human-to-zombie and zombie-to-human conversions. The paragraph explains how these dynamics can be represented by a Markov matrix, which is then used to predict the long-term outcome of the population. The concept of eigenvectors and eigenvalues is reintroduced to identify the equilibrium state of the system, showing that over time, the populations will converge to a stable ratio.

10:01

πŸ” Matrix Use in Image Processing: The Reginald Denny Case

This paragraph delves into the use of matrices in image processing, using the example of blurring an image. It explains how a kernel matrix is used to average pixel values in an image to achieve a blur effect. The explanation extends to how different kernels can be applied for various effects such as sharpening or edge detection. The paragraph concludes with a real-world application of these techniques in identifying a suspect in the Reginald Denny case by analyzing a video and using image processing to identify a distinguishing mark, which led to a conviction.

15:01

🌐 Exploring Networks and Graph Theory with Matrices

The focus of this paragraph is on the application of matrices in network and graph theory. It starts by illustrating how small networks can be intuitively understood but larger ones require mathematical tools for analysis. The concept of an adjacency matrix is introduced, which represents connections between nodes in a network. The paragraph explains how squaring the adjacency matrix can reveal mutual connections or paths of length two between nodes. It also touches on the idea of using matrix powers to find paths of various lengths and how the trace of the matrix cube can indicate the number of triangles in a network.

20:02

πŸ€– Matrices in Machine Learning and Neural Networks

This paragraph briefly mentions the role of matrices in machine learning and neural networks, highlighting that these technologies are coded and manipulated using matrix math. It also touches on the use of matrices in older encryption methods like the hill cipher, which incorporates matrix operations for encrypting and decrypting messages. The paragraph concludes with a mention of the importance of matrices in various fields, including security, and acknowledges the sponsorship of Dashlane, a password manager that focuses on internet safety and security.

25:02

πŸ“’ Conclusion and Call to Action

The final paragraph serves as a conclusion to the video, summarizing the importance and impact of matrices in various fields. It includes a call to action for viewers to like, subscribe, and follow the creator on social media for updates. It also mentions the use of a bell icon to ensure viewers receive notifications for future content.

Mindmap

Keywords

πŸ’‘Matrices

Matrices are rectangular arrays of numbers, symbols, or expressions, arranged in rows and columns. In the context of the video, matrices are used to perform operations on vectors, which can represent transformations in various systems. The video explains how matrices can scale and rotate vectors, which is fundamental to understanding more complex systems such as those in computer graphics and quantum mechanics. An example from the script is the transformation of a vector through matrix multiplication, resulting in a new vector that represents a scaled and rotated version of the original.

πŸ’‘Vector

A vector is a quantity that has both magnitude and direction. In the video, vectors are used to represent points in space, and they are manipulated using matrices to perform linear transformations. The script mentions a vector starting at the origin and ending at (1,1), which is then transformed by a matrix to result in a new vector (1,3), demonstrating the vector's change in both magnitude and direction.

πŸ’‘Eigenvectors and Eigenvalues

Eigenvectors are vectors that, when multiplied by a particular matrix, only change in scale and not in direction. The scale factor by which the eigenvector is multiplied is known as the eigenvalue. In the video, the concept is introduced to explain how certain vectors are only scaled and not rotated when acted upon by a matrix. The script uses the example of a vector that remains unchanged in direction but doubles in length when multiplied by a matrix, identifying it as an eigenvector with an eigenvalue of 2.

πŸ’‘Systems of Equations

Systems of equations consist of multiple equations with multiple variables. Matrices are instrumental in solving these systems, as they allow for the representation of the system in a compact form and the use of matrix operations to find solutions. The video script illustrates this by placing coefficients in one matrix, variables in another, and using matrix multiplication to find the output vector, which corresponds to the solution of the system.

πŸ’‘Linear Transformations

Linear transformations are functions that map vectors to vectors while preserving the operations of addition and scalar multiplication. The video emphasizes that matrices perform linear transformations on vectors, such as scaling and rotating, which are fundamental to various applications like computer graphics and image processing. The script provides examples of matrices that either rotate or scale vectors, maintaining the linearity of the transformation.

πŸ’‘Markov Matrix

A Markov matrix is a type of matrix used in probability theory to model transitions between different states in a system. The video uses a Markov matrix to represent a scenario of a zombie outbreak, where the matrix's columns sum to 1, and it has no negative values, representing the probabilities of humans turning into zombies or zombies being cured. The script demonstrates how the matrix can predict the long-term outcomes of the population dynamics.

πŸ’‘Google PageRank Algorithm

The Google PageRank algorithm is a way of measuring the importance of website pages. It works by considering the number and quality of links to a page as votes, with more votes indicating a higher value. The video mentions that the PageRank algorithm uses Markov matrices to rank websites by treating outgoing links as transition probabilities. This is an example of how matrices are used in real-world applications beyond traditional mathematical contexts.

πŸ’‘Image Processing

Image processing involves the manipulation of images using mathematical techniques. In the video, image processing is discussed in the context of using matrices to perform operations like blurring, sharpening, and edge detection. The script explains how a kernel matrix can be used to blur an image by averaging the pixel values in a region, demonstrating the practical application of matrices in digital image manipulation.

πŸ’‘Kernel

In image processing, a kernel is a small matrix used to apply a specific effect to an image. The video describes how different kernels can be used for various purposes, such as blurring (box blur), sharpening, or edge detection. The script provides an example of a kernel that averages the pixels within a region to create a blurred effect, showcasing the versatility of kernels in altering image properties.

πŸ’‘Graph Theory

Graph theory is a branch of mathematics that deals with graphs, which are mathematical structures used to model pairwise relations between objects. In the video, graph theory is used to analyze networks, such as social networks or the internet, through the use of matrices. The script introduces the concept of an adjacency matrix, which represents the connections between nodes in a graph, and how matrix operations can reveal properties of the network, like the presence of triangles or the number of mutual connections between nodes.

Highlights

Matrices are crucial in various fields such as circuit analysis, image processing, quantum mechanics, and the Google Page Rank algorithm.

Matrices can transform vectors through scaling and rotation, which is fundamental in linear algebra.

A matrix can represent a system that evolves over time, such as a zombie outbreak model with humans turning into zombies and vice versa.

Markov matrices, which sum to 1 in each column and have no negative values, are used to represent systems in equilibrium.

Eigenvectors and eigenvalues are used to determine the equilibrium state of a system, such as the long-term outcome of a zombie-human population model.

Matrices are instrumental in solving systems of linear equations, which is a common application in circuit analysis.

The Google Page Rank algorithm uses Markov matrices to rank websites based on the probability of transitioning from one site to another.

Image processing techniques using matrices helped identify a suspect in the Reginald Denny case by analyzing a rose tattoo affiliated with a gang.

Digital images can be represented as matrices, allowing for manipulation such as blurring, sharpening, and edge detection.

Different kernels or matrices can be applied to images for various effects, such as Gaussian blur or edge detection.

Matrices are used in computer graphics for geometric transformations and projecting 3D images onto a 2D plane.

In graph theory, adjacency matrices represent connections between nodes and can reveal information about the network's structure.

The power of an adjacency matrix can show the number of paths of a certain length between nodes in a graph.

Machine learning and neural networks heavily rely on matrix operations for their algorithms.

The Hill cipher is an older encryption method that uses matrix operations for encrypting and decrypting messages.

Dashlane, a password manager,θ΅žεŠ©ε•† was highlighted for its role in keeping users secure online with features like password storage, auto-fill, and security breach notifications.

Transcripts

play00:00

this video is sponsored by dash lane

play00:02

circuits and electronics image

play00:04

processing computer graphics quantum

play00:07

mechanics the Google page rank algorithm

play00:09

any kind of network other stuff these

play00:13

are the kinds of things where matrices

play00:15

are used and extremely important for

play00:17

understanding or analyzing different

play00:18

systems and although I can't discuss

play00:21

everything in one video this should give

play00:23

you some insight into the applications

play00:24

of matrices beyond an introductory

play00:26

course might include now in the

play00:29

beginning matrices can be one of the

play00:31

most boring subjects we learn in math

play00:32

maybe now for everyone but least that's

play00:34

how it was for me I mean we're told hey

play00:37

here's how matrix addition works real

play00:39

simply just some of the corresponding

play00:40

entries and you have your answer

play00:43

then multiply a matrix by a single

play00:46

number is as simple as multiplying every

play00:48

entry by that value but when it comes to

play00:52

matrix multiplication we do this weird

play00:54

row by column dot product multiplication

play00:57

which some teachers just give no context

play00:59

to so yeah this isn't the kind of stuff

play01:02

that makes you in a major in matrix math

play01:04

anytime soon I mean you might learn more

play01:07

in high school but overall a lot of it

play01:08

just isn't that exciting however I

play01:10

promise matrices are used way more than

play01:13

you probably think but the first thing

play01:15

we need to realize is that matrices do

play01:17

things two vectors don't take this as a

play01:20

definition cuz it's obviously not but we

play01:22

do need to see what happens when we

play01:23

multiply a matrix by a vector for

play01:27

example a vector that starts at the

play01:29

origin and ends at 1 comma 1 can be

play01:31

written in matrix form as shown X

play01:33

component on the top and Y component on

play01:35

the bottom and when you multiply by a

play01:38

2x2 matrix like this through the

play01:40

multiplication rules we get a new vector

play01:42

out in this case of 1 comma 3 so we put

play01:46

a vector in and the matrix scaled and

play01:49

rotate it to get a new vector out this

play01:53

is what I mean by the matrix doing

play01:55

things to the vector and in this case

play01:57

different inputs will be rotated and

play01:58

scaled differently which we'll see in a

play02:00

sec now some matrices are much simpler

play02:03

like this one here just rotates put a

play02:06

vector in aka multiplied by the matrix

play02:08

and out will come the same vector

play02:10

rotated 90 degrees counterclockwise

play02:13

this matrix on the other hand will just

play02:15

scale any vector that goes in comes out

play02:18

twice as long but most two-by-two

play02:21

matrices like this when we were

play02:23

analyzing aren't as simple different

play02:25

input vectors I'll just put a few here

play02:27

as an example gets scaled and rotated

play02:29

differently however the transformations

play02:32

are all linear as in any vector on the

play02:35

same line as one of those inputs will be

play02:37

mapped to a vector on the same line as

play02:39

the corresponding outputs these linear

play02:42

transformations are why we called the

play02:44

first in-depth class on matrices linear

play02:47

algebra anyways I'm going to redo those

play02:50

transformations once more but this time

play02:52

pay attention to this vector here you'll

play02:55

notice it's the only one that is just

play02:57

scaled it doesn't rotate at all and this

play03:00

would happen to any vector on that same

play03:02

line because of what we just saw any

play03:05

vector that is only scaled by a matrix

play03:07

is called an eigen vector of that matrix

play03:09

and how much the vector is scaled by or

play03:12

two in this case since the length

play03:13

doubled is known as the eigen value I'm

play03:17

not going to go through how to solve for

play03:18

these but the vocabulary will come up

play03:20

later now the last thing to mention is

play03:23

that the first application of matrices

play03:24

we typically learn is how they help us

play03:26

solve systems of equations the

play03:28

coefficients can go into a matrix the

play03:31

variables go into another and the

play03:33

outputs go here notice I'm using the

play03:36

same matrix as the one from the last

play03:38

slide by the way using the rules of

play03:41

matrix multiplication you can see that

play03:42

this and this are the exact same so

play03:46

really what this is asking is which

play03:48

input vector does this matrix map to 1

play03:52

comma 3 well we already saw the answer

play03:56

to this 1 comma 3 is this output and the

play03:59

question of which vector will the matrix

play04:01

map to this involves us just doing the

play04:04

same transformations as before but

play04:06

backwards to find the answer is 1 comma

play04:08

1 that will be our solution going

play04:12

backwards is like applying an inverse

play04:14

matrix and when the desired output is

play04:16

the one being multiplied then the vector

play04:19

it came from comes out so x equals 1 and

play04:22

y equals 1 are the solutions if we plug

play04:25

those into the

play04:26

some equations than both are satisfied

play04:28

which is exactly what we were looking

play04:30

for if you haven't seen three blue one

play04:34

Browns essence of linear algebra series

play04:36

definitely check that out this will make

play04:38

a lot more sense but here we're focused

play04:40

on applications which we're going to get

play04:42

to now now in systems of equations get

play04:45

more complex all we have to do is expand

play04:47

our matrix and we can analyze the system

play04:49

with as many variables as we want the

play04:52

reason matrices are used in circuits and

play04:54

electronics for example is because these

play04:56

can be represented by linear equations

play04:58

in which all the voltages and currents

play05:00

are the unknown variables when the

play05:03

circuits get hectic where we don't want

play05:05

to solve it by hand we can just have a

play05:06

computer find an inverse matrix and

play05:08

we'll have our currents and voltages but

play05:11

that's still not too exciting so what

play05:13

about a system that continuously evolves

play05:15

over time like for example let's say

play05:18

there's a zombie outbreak at the local

play05:19

high school

play05:20

pretty standard situation and the place

play05:22

is quarantined so no one can go in or

play05:24

out but the zombie infection is

play05:26

spreading so we've got humans in the

play05:29

school and zombies but no one is coming

play05:31

in or out so the population remains the

play05:33

same now let's say every hour 20% of

play05:37

humans will turn into zombies due to

play05:38

being infected there is a cure for the

play05:41

disease luckily however it's not always

play05:43

guaranteed to work so we'll say that

play05:44

every hour 10% of the zombies will

play05:47

return back to humans at this moment if

play05:50

there are 150 zombies and 150 humans the

play05:54

question is what is going to happen in

play05:56

the long run now we're going to assume

play05:59

the changes happen in discrete intervals

play06:01

at the hour so let's see what happens in

play06:04

the first hour for the humans of the 150

play06:07

starting out 80% of them are going to

play06:09

stay human or not become infected but we

play06:12

also have to add the 10% of the 150

play06:15

zombies that become cured and turned

play06:17

back to human

play06:18

this leaves us with a hundred and

play06:20

thirty-five humans after that first hour

play06:22

it went down just a bit for the new

play06:26

total of zombies we would take the 20%

play06:28

of humans that got infected plus the 90%

play06:31

of the 150 zombies that are not cured

play06:34

giving us a total of of course 165 since

play06:37

these two numbers add together muster

play06:39

300 but we want to know what happens

play06:44

after a long time so we got to keep

play06:46

going after another hour we write the

play06:49

same percentages except now the number

play06:50

of humans is 135 instead of 150 and for

play06:54

the zombies we got 165 instead of 150

play06:56

this now puts 125 for the humans and 175

play07:00

for the zombies so we seem to keep

play07:02

losing humans but will this continue

play07:06

well what we have here is some linear

play07:08

equations that can be represented as a

play07:10

matrix of those percentages which don't

play07:12

change this is multiplied by the inputs

play07:15

hmz or the current population of humans

play07:17

and zombies at any time and all of this

play07:20

equals the populations after that given

play07:22

our this is called a markov matrix by

play07:25

the way since its column sum to 1 and it

play07:27

has no negative values but this is like

play07:29

what we just saw the matrix we have is

play07:32

going to do stuff to or scale and rotate

play07:34

the input vector the first input was 150

play07:39

comma 150 the initial human and zombie

play07:41

populations and after 1 hour or

play07:43

multiplication it gets moved to 135

play07:46

comma 165 but we have to keep going and

play07:50

apply another transformation sending it

play07:52

to 125 comma 175 the populations we

play07:55

found after 2 hours so as we keep

play07:58

applying these multiplications the real

play08:00

question is where does this vector go

play08:03

well let me put a few vectors on the

play08:05

graph to show this each representing

play08:07

populations which add to 300 if we do

play08:10

the matrix multiplication and look at

play08:12

the transformations you'll notice this

play08:14

vector or anything on this line stays

play08:16

put while everything else moves towards

play08:19

it that vector is an eigenvector of our

play08:23

matrix the associated eigenvalue is 1

play08:25

since it doesn't scale and since that

play08:29

vector doesn't rotate or scale it is the

play08:31

equilibrium of the system and therefore

play08:33

the answer to our question after a long

play08:36

time the populations will settle to

play08:38

numbers which lie on this line and add

play08:41

to 300 which would be 100 for the humans

play08:44

and 200 for the zombies any other

play08:46

population values we'll just move a

play08:48

little closer to these after each hour

play08:52

if you put those values inside the

play08:54

equations from before you'll see the

play08:56

output remains 100 and 200 for the

play08:59

humans and zombies respectively then if

play09:02

the percentages were to change the

play09:04

question just comes down to what is the

play09:06

eigenvector of the new matrix there may

play09:09

not be a zombie infestation anytime soon

play09:11

but this kind of math could be used to

play09:13

analyze how a virus will spread

play09:15

throughout a population for example and

play09:17

one of my favorite applications of this

play09:19

is the Google page rank algorithm which

play09:21

involves Markov matrices and ranks

play09:24

websites by treating outgoing links as

play09:26

probabilities of transitioning from one

play09:28

site to another for more on that I have

play09:31

a dedicated video which I'll link below

play09:33

now moving on here's a happy story not

play09:36

at all on April 29 1992 a man named

play09:40

Reginald Denny was beaten nearly to

play09:42

death live on national TV and this was

play09:45

just a completely innocent man who had

play09:47

done nothing wrong you can see Reginald

play09:50

laying here probably unconscious after

play09:52

the attack the attack itself can be seen

play09:55

here on YouTube but in an attempt to

play09:57

knock an age-restricted like that video

play09:59

is I'm only showing the portion right

play10:00

after now the back story here is that

play10:03

April 29th 92 was the first day of the

play10:06

Rodney King riots in Los Angeles

play10:08

Reginald Denny was a truck driver whose

play10:11

route for the day involved going through

play10:13

an area where rioting was taking place

play10:14

which he was not informed about when he

play10:17

got there he was stopped by rioters

play10:19

dragged out of his truck and that's when

play10:21

the beating took place now identifying

play10:24

who assaulted Denny was not easy since

play10:26

the quality of the live footage wasn't

play10:28

amazing but what help law enforcement

play10:30

confidently identify one of the

play10:32

attackers with some advanced math to

play10:36

understand how this was accomplished we

play10:38

need to first look at what a digital

play10:40

images a digital image when you look

play10:42

real closely is just made up of a bunch

play10:45

of pixels each of a single color those

play10:47

colors can then be represented by some

play10:49

numerical value which means like a

play10:52

square picture made up of a million

play10:54

pixels 1000 on each edge could be

play10:56

represented by a thousand by 1,000

play10:59

matrix where the entries are the color

play11:01

values of each pixel

play11:03

working with black-and-white pictures is

play11:05

much easier though because the black

play11:06

pixel come you represented with a zero

play11:08

and a white can be a 1 let's say well

play11:11

actually work with grayscale images here

play11:13

though meaning anything in between zero

play11:15

and one can exist which will correspond

play11:17

to a different shade of grey so when it

play11:20

comes to image processing and

play11:21

manipulation whether it be blurring an

play11:23

image detecting edges sharpening an

play11:26

image and so on it all comes down to

play11:29

manipulating the pixels in a very

play11:31

specific way to see an example let's

play11:34

mathematically blur this image of the

play11:35

number 1 to do so I'm going to make a 3

play11:39

by 3 matrix where every entry is 1/9

play11:42

this is known as a kernel and image

play11:44

processing by the way then what we're

play11:47

going to do is lay this kernel over our

play11:49

image matrix and multiply the individual

play11:52

entries in each square together then add

play11:54

the results in this case it's just 1

play11:57

times 1/9 nine times so the sum of all

play12:00

those is one yes this kernel is really

play12:03

just finding the average of the pixels

play12:04

inside it from there we're going to take

play12:08

that sum of one and set the center pixel

play12:10

to that color in the new image it just

play12:13

so happened not to change it's still 1

play12:15

or white but that won't always be the

play12:17

case now you'll notice this grid on the

play12:20

right where the blurred image will go is

play12:21

the same size as the one on the left to

play12:24

get the entire blurred image we're just

play12:26

going to sweep that red section across

play12:28

the original one when we slide it over

play12:30

once all those pixels are still 1 so the

play12:33

average is also 1 and that's where this

play12:35

new pixel becomes but after sliding over

play12:38

again the kernel contains a black pixel

play12:41

so we find the average of 8 ones and a

play12:44

zero which is about point eight nine

play12:46

this corresponds to a very light shade

play12:48

of gray which we will put in that middle

play12:50

square after sweeping across the image

play12:54

mapping each new number to the blurred

play12:55

image these will be the values I know

play12:59

this method doesn't really account for

play13:01

the border but for our purposes we're

play13:03

just going to keep that white now I'll

play13:05

actually color and the pixels based on

play13:07

their values and we get a blurred image

play13:09

of the number one

play13:11

actually this is extremely blurred

play13:13

almost beyond recognition but if we put

play13:15

an outline along the colored region we

play13:17

can see the one is still kind of there

play13:20

the reason this is so blurred is because

play13:22

we're only working with a hundred pixels

play13:24

but what the kernel did was kind of took

play13:27

this sharp edge in the original image

play13:28

between black and white

play13:30

and smooth or averaged it so we get this

play13:33

fading from dark to light in the blurred

play13:35

image the kernel we use represents a

play13:39

type of blur known as a box blur and

play13:41

from Wikipedia if you input a picture

play13:43

with many more pixels then apply the

play13:45

blur this is the output you get but

play13:48

there are several other kernels that'll

play13:49

all accomplish different things a

play13:51

Gaussian blur also of course blurs the

play13:54

image but it assigns more weight to the

play13:56

middle square so dark pixels stay fairly

play13:58

dark and vice versa there's a sharpen

play14:01

kernel and there's edge detection

play14:04

kernels which search for sharp changes

play14:06

in color you'll notice that all the

play14:09

numbers in this kernel sum to zero so if

play14:11

we put it over a section of an image

play14:13

where all colors are roughly the same

play14:15

multiplying by these numbers then adding

play14:17

the results would just yield zero or a

play14:19

black pixel which is why that

play14:21

corresponding area is black the only

play14:24

sections that aren't are where we find

play14:26

sharp changes in color aka an edge as

play14:30

another example of edge detection here's

play14:33

a poorly taken photograph of someone's

play14:35

arm and by using edge detection

play14:37

algorithms researchers were able to

play14:38

identify a region of some kind of

play14:40

birthmark or tattoo well this is

play14:43

actually a zoomed in portion of this

play14:45

image where those men can be seen

play14:47

beating Reginald any using image

play14:49

processing techniques similar to what

play14:51

we've seen one company was able to

play14:53

determine that this mark was a rose

play14:54

tattoo affiliated with a certain gang in

play14:57

Los Angeles and it was this that helped

play14:59

him eventually secure a conviction of

play15:01

one of the perpetrators of the attack

play15:05

now all this may not have involved much

play15:08

matrix math like we saw earlier but no I

play15:10

did simplify some things to avoid going

play15:12

in too much detail and not only image

play15:14

processing but computer graphics heavily

play15:16

use matrices with these what we can do

play15:19

is take geometric data and incorporate

play15:21

it into a coordinate system we can then

play15:24

scale rotate reflect shift images and

play15:27

more through matrix manipulation but

play15:30

things do get much more complicated like

play15:32

when you want to project a 3d image into

play15:34

a 2d plane we can use matrix map to map

play15:37

the 3d points and find where they would

play15:40

appear on the flat screen not going to

play15:44

go into much more detail in that but

play15:45

again computer graphics are another very

play15:47

useful application of matrices but for

play15:51

those wanting some real tangible results

play15:53

that come from matrix math let's look at

play15:55

networks and graph theory graphs can

play15:59

represent a lot of things people and who

play16:01

they're friends with connections on a

play16:03

dating app networks of cities and how

play16:06

they're connected websites and how they

play16:08

link to each other and so on with small

play16:11

networks it can be easy to intuitively

play16:13

understand what's going on like if I

play16:16

said here's a group of coworkers and

play16:17

connections represent mutual friendships

play16:19

it wouldn't be hard to see like this is

play16:21

the most popular person and this is the

play16:24

least popular with only one friend if

play16:26

you had to find how many mutual friends

play16:28

these two people have no big deal you

play16:29

can just count and see that's three but

play16:33

when the networks get more complex we

play16:34

need mathematical tools to help us

play16:36

identify key things this could be like

play16:39

which website should be ranked the

play16:40

highest on the web which I mentioned

play16:42

earlier it could be finding who is more

play16:44

likely to spread a disease and a college

play16:45

full of students for which people

play16:48

involved in the 9/11 terrorist attacks

play16:49

were most critical to the operation and

play16:51

should be prioritized by law enforcement

play16:53

yes they actually did this after 9/11

play16:56

which I have discussed in a previous

play16:57

video we need some mathematical

play17:00

techniques in these cases so we can find

play17:02

things that our eyes aren't always able

play17:03

to when the connections get this chaotic

play17:05

but let's do a matrices can reveal when

play17:08

it comes to dating apps imagine this app

play17:11

only has three men signed up that will

play17:13

label 1 through 3 and 3 women labeled 4

play17:16

through 6 and there

play17:17

together as shown these are mutual

play17:21

connections by the way like both people

play17:23

swiping right and you'll know for now

play17:25

there are no same-sex matches we see

play17:28

this first guys matched with all three

play17:30

women the second guy with two and the

play17:32

third with one

play17:33

now this graph provides a nice visual

play17:36

for this situation but what we can also

play17:38

do is make a table with six rows and six

play17:40

columns for the six people and analyze

play17:43

this instead we'll say if two people are

play17:46

matched like person one in person for

play17:48

our then in the square located and in

play17:50

column 1 and row four we will put a 1

play17:54

however since these are mutual

play17:56

connections we need to also include a 1

play17:58

in column 4 and Row 1 basically if one

play18:02

matches with 4 then of course 4 has

play18:04

matched with 1 so the data has to

play18:05

reflect that so that means yes the

play18:08

tables going to be symmetric about the

play18:10

diagonal then if two people are not

play18:13

connected like person 1 and 2 we'll put

play18:16

a 0 in that square in this case column 1

play18:18

in row 2 but of course we can't forget

play18:20

column 2 and row 1 since no one matches

play18:23

with themself the diagonal is going to

play18:25

be all zeros and then these would be the

play18:28

rest of the connections so if you want

play18:30

to know whether person 5 and 2 are

play18:32

connected by the table just go to column

play18:34

5 and Row 2 or vice versa and see if

play18:37

there's a one or a zero there from this

play18:40

there are obvious things we can see like

play18:42

for person 1 we can look down their

play18:44

column or across the row and find they

play18:46

have three matches in total because of

play18:48

the three ones but we're going to use

play18:50

some slightly more advanced math to

play18:52

analyze this graph so instead of

play18:54

considering this a table we're going to

play18:56

call it a matrix but it's taking away

play18:58

the gridlines but otherwise nothing has

play18:59

changed when it comes to graphs this is

play19:02

known as an adjacency matrix another way

play19:06

to interpret this though is that it

play19:07

tells us how many paths of length one

play19:09

exists between any two nodes oh and for

play19:13

the rest of this video when I say path I

play19:15

just mean any sequence of edges that

play19:17

joins a sequence of vertices basically

play19:19

just a walk those no graph theory may

play19:22

not like this because a path is usually

play19:24

more specific but I am being generic

play19:26

here okay so what's this really mean

play19:28

we'll look at column 6 and row 1

play19:31

we know this says that those two people

play19:33

are matched no big deal

play19:35

but it also means there is one path of

play19:37

length one that exists between them

play19:40

those are saying the same thing if we

play19:42

put a dot at person 1 and can only

play19:44

traverse one edge well there's one way

play19:47

to get to person 6 that's what this one

play19:49

represents on the other hand there are

play19:52

zero ways to get from person 1 to person

play19:55

2 in one edge if you start a person 1

play19:58

there are paths to person 2 but they all

play20:01

have a length of 2 which is not what we

play20:03

were looking for but now what if I want

play20:07

to see quickly how many mutual matches

play20:09

two people have well if we look at

play20:11

person 1 and 2 this isn't tough we see

play20:14

there are 2 mutual matches however this

play20:17

question of mutual matches is no

play20:19

different than asking how many paths of

play20:22

length 2 exists between person 1 and

play20:25

person 2 well we just saw that the

play20:28

answer is 2 as expected since it's the

play20:30

same question again if I start at 1 and

play20:33

go to 4 than 2 or 5 than 2 those two

play20:36

paths mean two mutual connections the

play20:40

cool thing though is that we can find

play20:41

how many of these paths of length 2

play20:43

exist between any two nodes by just

play20:46

multiplying the adjacency matrix by

play20:47

itself or squaring it we see for person

play20:51

1 and 2 there are 2 mutual connections

play20:54

so that checks out then if you look at

play20:56

the graph for person 2 and 3 they have

play20:58

no mutual connections and on the matrix

play21:01

this checks out as well from column 3

play21:03

and Row 2 having a 0 however person 1

play21:07

and 3 are both connected to 6 and no one

play21:10

else which we can also find in the

play21:11

matrix and you get the idea but now what

play21:15

would the diagonal mean well that's how

play21:17

many paths of length 2 it exists between

play21:20

a person and themselves

play21:21

aka how many matches they have think

play21:24

about it for person 1 if I start there

play21:27

to get back to 1 in two edges I can go

play21:30

into 4 than 1 5 than 1 or 6 and 1 3

play21:34

options for the 3 connections this is

play21:37

why we see a 3 there in the matrix

play21:39

person 2 that has two matches and it

play21:42

goes up

play21:44

then if we multiply the new matrix by

play21:46

the original the same as finding the

play21:48

original cubed we get all the paths of

play21:51

length 3 from one person to another see

play21:55

the original matrix to some power tells

play21:57

us how many paths of that length exist

play21:59

between any two notes now if we have a

play22:03

same-sex connection and link one to two

play22:05

let's say all we have to do is add a 1

play22:07

to the original matrix in the first

play22:09

column second row and vice versa

play22:11

see when implementing this in the

play22:13

software we just have to make small

play22:15

tweaks to the adjacency matrix and from

play22:17

there squaring or cubing it tells us a

play22:19

lot actually something I found

play22:21

interesting was what the matrix cube

play22:23

tells us specifically the diagonal for

play22:26

one it tells us how many paths of length

play22:27

three exists between a person and

play22:29

themselves but looking at the graph a

play22:31

length three path back to yourself tells

play22:34

us there's a triangle there I'm not

play22:37

going to explain this one in depth but

play22:39

if you sum the numbers along the

play22:41

diagonal also known as the trace of the

play22:43

matrix and divide by six that tells you

play22:46

how many triangles in total there are in

play22:48

the network I just found that to be a

play22:51

cool thing the matrix tells us which you

play22:52

wouldn't think about it first then on

play22:56

another topic something I haven't even

play22:57

mentioned yet is machine learning and

play22:59

neural networks which are coded with and

play23:01

manipulated by matrix math

play23:04

mathematically matrices are a huge

play23:05

aspect of what allows the machine to

play23:07

quote learn or in terms of security

play23:11

there's an example of an older kind of

play23:12

encryption method which is the hill

play23:14

cipher this cipher incorporates matrix

play23:17

operations in order to encrypt and

play23:19

decrypt messages although no it's not a

play23:21

modern encryption method and as much as

play23:24

I'd love to keep going into depth on

play23:26

different subjects this video is already

play23:27

quite long so hopefully this show just

play23:29

how powerful and impactful matrices are

play23:32

though but also regarding encryption and

play23:34

security I do want to thank dashlane for

play23:36

sponsoring this video a company that's

play23:37

dedicated to keeping you safe and secure

play23:39

on the internet - Lane is a password

play23:42

manager that well there's several things

play23:44

when it'll safely store all your

play23:46

passwords all in one place and sync them

play23:49

between devices so you never have to

play23:50

deal with resetting all those passwords

play23:52

you made months or years ago that you

play23:53

can't remember

play23:54

with this - lien will also autofill user

play23:57

names and passwords for any site you

play23:59

have stored in their vault making it

play24:00

just a little easier to navigate the

play24:01

internet something more important than

play24:04

remembering passwords though is having

play24:05

secure passwords and being safe from

play24:07

hackers which - lien takes care of we're

play24:10

totally shouldn't store the same

play24:11

password for different sites since being

play24:13

hacked in one place makes you vulnerable

play24:15

elsewhere now in dashlane that is solved

play24:17

as you have the option to have them

play24:18

auto-generate very secure passwords to

play24:21

be stored and used across all your

play24:22

devices you will have one single master

play24:25

password that you create when you sign

play24:26

up for dashlane and that is used to

play24:28

encrypt all others so even if someone

play24:30

were to gain access to internal servers

play24:32

they would just see gibberish you on the

play24:35

other hand can feel safe knowing you

play24:36

have different and very secure passwords

play24:38

for each site yet all you have to do is

play24:40

remember one single password plus four

play24:43

add security they'll notify you if any

play24:44

of your data has been compromised to

play24:46

give you a complete peace of mind as you

play24:48

browse the Internet

play24:49

pricing is already really cheap but if

play24:51

you sign up at the link below or go to -

play24:53

link comm slash major prep you'll get

play24:55

10% off your premium subscription plus

play24:57

there's a 30-day free trial so no risk

play24:59

and just giving it a try again links are

play25:01

below and with that I'm gonna end that

play25:03

video there you guys enjoyed be sure to

play25:05

LIKE and subscribe don't forget to

play25:06

follow me on Twitter hit the bell if

play25:08

you're not being notified and I'll see

play25:09

you all in the next video

Rate This
β˜…
β˜…
β˜…
β˜…
β˜…

5.0 / 5 (0 votes)

Related Tags
MatricesLinear AlgebraCircuitsElectronicsImage ProcessingQuantum MechanicsGoogle PageRankNetwork AnalysisEncryptionMachine Learning