1.10 Vectors and Matrices

What are they and why to we care about them ?

Vectors

What are they ?

(c) One Fourth Labs

  • Magnitude of a vector
  • Direction of a vector

Magnitude of a vector

 

\sqrt{(x_1^2 + x_2^2)}
(x12+x22)\sqrt{(x_1^2 + x_2^2)}
\sqrt{2^2 + 2^2} = 2\sqrt{2}
22+22=22\sqrt{2^2 + 2^2} = 2\sqrt{2}
\sqrt{(-2)^2+1^2} = \sqrt{5}
(2)2+12=5\sqrt{(-2)^2+1^2} = \sqrt{5}
\sqrt{1.5^2+(-2)^2} = 2.5
1.52+(2)2=2.5\sqrt{1.5^2+(-2)^2} = 2.5
\sqrt{1^2+1^2} = \sqrt{2}
12+12=2\sqrt{1^2+1^2} = \sqrt{2}
\sqrt{(-1)^2+1^2} = \sqrt{2}
(1)2+12=2\sqrt{(-1)^2+1^2} = \sqrt{2}

Magnitude of (2,2)

Magnitude of (-2,1)

Magnitude of (1.5,-2)

Magnitude of (1,1)

Magnitude of (-1,1)

Vectors

What are they ? (some jargon)

(c) One Fourth Labs

Euclidean Space

In geometry, a two- or three-dimensional space in which the axioms and postulates of Euclidean geometry apply is a Euclidean space. A space in any finite number of dimensions, in which points are designated by coordinates (one for each dimension) and the distance between two points is given by a distance formula.

2D Euclidean Space

3D Euclidean Space

In geometry, a two- or three-dimensional space in which the axioms and postulates of Euclidean geometry apply is a Euclidean space. A space in any finite number of dimensions, in which points are designated by coordinates (one for each dimension) and the distance between two points is given by a distance formula. L2 Norm is also called Euclidean norm.

In geometry, a two- or three-dimensional space in which the axioms and postulates of Euclidean geometry apply is a Euclidean space. A space in any finite number of dimensions, in which points are designated by coordinates (one for each dimension) and the distance between two points is given by a distance formula

In geometry, a two- or three-dimensional space in which the axioms and postulates of Euclidean geometry apply is a Euclidean space. A space in any finite number of dimensions, in which points are designated by coordinates (one for each dimension) and the distance between two points is given by a distance formula

Vectors

How do you add two vectors ?

(c) One Fourth Labs

\begin{bmatrix} -2 \\1 \end{bmatrix} + \begin{bmatrix} 1 \\1.5 \end{bmatrix} = \begin{bmatrix} ? \\? \end{bmatrix}
[21]+[11.5]=[??]\begin{bmatrix} -2 \\1 \end{bmatrix} + \begin{bmatrix} 1 \\1.5 \end{bmatrix} = \begin{bmatrix} ? \\? \end{bmatrix}

Addition

\begin{bmatrix} 0.1 \\0.4 \\0.4 \end{bmatrix} + \begin{bmatrix} 0.4 \\0.1 \\0.3 \end{bmatrix} = \begin{bmatrix} ? \\? \\? \end{bmatrix}
[0.10.40.4]+[0.40.10.3]=[???]\begin{bmatrix} 0.1 \\0.4 \\0.4 \end{bmatrix} + \begin{bmatrix} 0.4 \\0.1 \\0.3 \end{bmatrix} = \begin{bmatrix} ? \\? \\? \end{bmatrix}
\begin{bmatrix} -2 \\1 \end{bmatrix} + \begin{bmatrix} 1 \\1.5 \end{bmatrix} = \begin{bmatrix} -1 \\2.5 \end{bmatrix}
[21]+[11.5]=[12.5]\begin{bmatrix} -2 \\1 \end{bmatrix} + \begin{bmatrix} 1 \\1.5 \end{bmatrix} = \begin{bmatrix} -1 \\2.5 \end{bmatrix}
\begin{bmatrix} 0.1 \\0.4 \\0.4 \end{bmatrix} + \begin{bmatrix} 0.4 \\0.1 \\0.3 \end{bmatrix} = \begin{bmatrix} 0.5 \\0.5 \\0.7 \end{bmatrix}
[0.10.40.4]+[0.40.10.3]=[0.50.50.7]\begin{bmatrix} 0.1 \\0.4 \\0.4 \end{bmatrix} + \begin{bmatrix} 0.4 \\0.1 \\0.3 \end{bmatrix} = \begin{bmatrix} 0.5 \\0.5 \\0.7 \end{bmatrix}
\begin{bmatrix} -2 \\1 \end{bmatrix} + \begin{bmatrix} 1 \\1.5 \end{bmatrix} = \begin{bmatrix} -1 \\2.5 \end{bmatrix}
[21]+[11.5]=[12.5]\begin{bmatrix} -2 \\1 \end{bmatrix} + \begin{bmatrix} 1 \\1.5 \end{bmatrix} = \begin{bmatrix} -1 \\2.5 \end{bmatrix}
\begin{bmatrix} -2 \\1 \end{bmatrix} + \begin{bmatrix} 1 \\1.5 \end{bmatrix} = \begin{bmatrix} -1 \\2.5 \end{bmatrix}
[21]+[11.5]=[12.5]\begin{bmatrix} -2 \\1 \end{bmatrix} + \begin{bmatrix} 1 \\1.5 \end{bmatrix} = \begin{bmatrix} -1 \\2.5 \end{bmatrix}

Vectors

How do you subtract two  vectors ?

(c) One Fourth Labs

\begin{bmatrix} 1 \\1.5 \end{bmatrix} - \begin{bmatrix} -2 \\1 \end{bmatrix} = \begin{bmatrix} ? \\? \end{bmatrix}
[11.5][21]=[??]\begin{bmatrix} 1 \\1.5 \end{bmatrix} - \begin{bmatrix} -2 \\1 \end{bmatrix} = \begin{bmatrix} ? \\? \end{bmatrix}

Subtraction

\begin{bmatrix} 0.4 \\0.9 \\0.6 \end{bmatrix} - \begin{bmatrix} 0.1 \\0.2 \\0.3 \end{bmatrix} = \begin{bmatrix} ? \\? \\? \end{bmatrix}
[0.40.90.6][0.10.20.3]=[???]\begin{bmatrix} 0.4 \\0.9 \\0.6 \end{bmatrix} - \begin{bmatrix} 0.1 \\0.2 \\0.3 \end{bmatrix} = \begin{bmatrix} ? \\? \\? \end{bmatrix}
\begin{bmatrix} -2 \\1 \end{bmatrix} - \begin{bmatrix} 1 \\1.5 \end{bmatrix} = \begin{bmatrix} 3 \\0.5 \end{bmatrix}
[21][11.5]=[30.5]\begin{bmatrix} -2 \\1 \end{bmatrix} - \begin{bmatrix} 1 \\1.5 \end{bmatrix} = \begin{bmatrix} 3 \\0.5 \end{bmatrix}
\begin{bmatrix} 0.4 \\0.9 \\0.6 \end{bmatrix} - \begin{bmatrix} 0.1 \\0.2 \\0.3 \end{bmatrix} = \begin{bmatrix} 0.3 \\0.7 \\0.3\end{bmatrix}
[0.40.90.6][0.10.20.3]=[0.30.70.3]\begin{bmatrix} 0.4 \\0.9 \\0.6 \end{bmatrix} - \begin{bmatrix} 0.1 \\0.2 \\0.3 \end{bmatrix} = \begin{bmatrix} 0.3 \\0.7 \\0.3\end{bmatrix}
\begin{bmatrix} 1\\1.5 \end{bmatrix} - \begin{bmatrix} -2 \\ 1 \end{bmatrix} = \begin{bmatrix} 3 \\0.5 \end{bmatrix}
[11.5][21]=[30.5]\begin{bmatrix} 1\\1.5 \end{bmatrix} - \begin{bmatrix} -2 \\ 1 \end{bmatrix} = \begin{bmatrix} 3 \\0.5 \end{bmatrix}

Vectors

How do you multiply two  vectors ?

(c) One Fourth Labs

\begin{bmatrix} -2 \\1 \end{bmatrix} . \begin{bmatrix} 1 \\1.5 \end{bmatrix} = \begin{bmatrix} ? \\? \end{bmatrix}
[21].[11.5]=[??]\begin{bmatrix} -2 \\1 \end{bmatrix} . \begin{bmatrix} 1 \\1.5 \end{bmatrix} = \begin{bmatrix} ? \\? \end{bmatrix}

Multiply

\begin{bmatrix} 2.1 \\2.4 \\4.1 \end{bmatrix} . \begin{bmatrix} 1.4 \\2.1 \\1.1 \end{bmatrix} = \begin{bmatrix} ? \\? \\? \end{bmatrix}
[2.12.44.1].[1.42.11.1]=[???]\begin{bmatrix} 2.1 \\2.4 \\4.1 \end{bmatrix} . \begin{bmatrix} 1.4 \\2.1 \\1.1 \end{bmatrix} = \begin{bmatrix} ? \\? \\? \end{bmatrix}
\begin{bmatrix} -2 \\1 \end{bmatrix} . \begin{bmatrix} 1 \\1.5 \end{bmatrix} = \begin{bmatrix} -2 \\1.5 \end{bmatrix}
[21].[11.5]=[21.5]\begin{bmatrix} -2 \\1 \end{bmatrix} . \begin{bmatrix} 1 \\1.5 \end{bmatrix} = \begin{bmatrix} -2 \\1.5 \end{bmatrix}
\begin{bmatrix} 2.1 \\2.4 \\4.1 \end{bmatrix} . \begin{bmatrix} 1.4 \\2.1 \\1.1 \end{bmatrix} = \begin{bmatrix} 2.94 \\5.04 \\4.51 \end{bmatrix}
[2.12.44.1].[1.42.11.1]=[2.945.044.51]\begin{bmatrix} 2.1 \\2.4 \\4.1 \end{bmatrix} . \begin{bmatrix} 1.4 \\2.1 \\1.1 \end{bmatrix} = \begin{bmatrix} 2.94 \\5.04 \\4.51 \end{bmatrix}
\begin{bmatrix} -2 \\ 1 \end{bmatrix} . \begin{bmatrix} 1 \\1.5 \end{bmatrix} = \begin{bmatrix} -2 \\1.5 \end{bmatrix}
[21].[11.5]=[21.5]\begin{bmatrix} -2 \\ 1 \end{bmatrix} . \begin{bmatrix} 1 \\1.5 \end{bmatrix} = \begin{bmatrix} -2 \\1.5 \end{bmatrix}

Vectors

How do you project a vector onto another ?

(c) One Fourth Labs

\vec{y}
y\vec{y}
\vec{x}
x\vec{x}
proj_{\vec{y}}\vec{x}
projyxproj_{\vec{y}}\vec{x}
proj_{\vec{y}}\vec{x} =
projyx=proj_{\vec{y}}\vec{x} =
\Big( \ \ \ \ \ \ \ \Big) \vec{y}
(       )y\Big( \ \ \ \ \ \ \ \Big) \vec{y}
\Big(\frac{\vec{x} ⋅ \vec{y}}{||\vec{y}||^2} \Big) \vec{y}
(xyy2)y\Big(\frac{\vec{x} ⋅ \vec{y}}{||\vec{y}||^2} \Big) \vec{y}

Vectors

How do you project a vector onto another ?

(c) One Fourth Labs

\vec{y}
y\vec{y}
\vec{x}
x\vec{x}
proj_{\vec{x}}\vec{y}
projxyproj_{\vec{x}}\vec{y}
proj_{\vec{x}}\vec{y} =
projxy=proj_{\vec{x}}\vec{y} =
\Big( \ \ \ \ \ \ \ \Big) \vec{x}
(       )x\Big( \ \ \ \ \ \ \ \Big) \vec{x}
\Big(\frac{\vec{x} ⋅ \vec{y}}{||\vec{x}||^2} \Big) \vec{x}
(xyx2)x\Big(\frac{\vec{x} ⋅ \vec{y}}{||\vec{x}||^2} \Big) \vec{x}

Vectors

How do you project a vector onto another ?

(c) One Fourth Labs

\vec{x} = \begin{bmatrix} 2 \\ 2 \end{bmatrix}
x=[22]\vec{x} = \begin{bmatrix} 2 \\ 2 \end{bmatrix}
\vec{y} = \begin{bmatrix} 0 \\ 1 \end{bmatrix}
y=[01]\vec{y} = \begin{bmatrix} 0 \\ 1 \end{bmatrix}
\vec{x} . \vec{y} = 2 \times 0 + 2 \times 1 = 2
x.y=2×0+2×1=2\vec{x} . \vec{y} = 2 \times 0 + 2 \times 1 = 2
proj_{\vec{y}}\vec{x} =
projyx=proj_{\vec{y}}\vec{x} =
\Big(\frac{\vec{x} ⋅ \vec{y}}{||\vec{y}||^2} \Big) \vec{y}
(xyy2)y\Big(\frac{\vec{x} ⋅ \vec{y}}{||\vec{y}||^2} \Big) \vec{y}
||y||^2 = \sqrt{0^2 + 1^2} = 1
y2=02+12=1||y||^2 = \sqrt{0^2 + 1^2} = 1
= \Big( \frac{2}{1} \Big) \begin{bmatrix} 0 \\ 1 \end{bmatrix}
=(21)[01]= \Big( \frac{2}{1} \Big) \begin{bmatrix} 0 \\ 1 \end{bmatrix}
= \begin{bmatrix} 0 \\ 2 \end{bmatrix}
=[02]= \begin{bmatrix} 0 \\ 2 \end{bmatrix}
?
??
\vec{x} = \begin{bmatrix} 2 \\ 2 \end{bmatrix}
x=[22]\vec{x} = \begin{bmatrix} 2 \\ 2 \end{bmatrix}
\vec{y} = \begin{bmatrix} 0 \\ 1 \end{bmatrix}
y=[01]\vec{y} = \begin{bmatrix} 0 \\ 1 \end{bmatrix}
\begin{bmatrix} 0 \\ 2 \end{bmatrix}
[02]\begin{bmatrix} 0 \\ 2 \end{bmatrix}

Vectors

How do you project a vector onto another ?

(c) One Fourth Labs

proj_{\vec{y}}\vec{x} =
projyx=proj_{\vec{y}}\vec{x} =
\Big(\frac{\vec{x} ⋅ \vec{y}}{||\vec{y}||^2} \Big) \vec{y}
(xyy2)y\Big(\frac{\vec{x} ⋅ \vec{y}}{||\vec{y}||^2} \Big) \vec{y}
||y||^2 = \sqrt{2^2 + 2^2 + 1^2} = 3
y2=22+22+12=3||y||^2 = \sqrt{2^2 + 2^2 + 1^2} = 3
= \Big( \frac{11}{3} \Big) \begin{bmatrix} 2 \\ 2 \\ 1 \end{bmatrix}
=(113)[221]= \Big( \frac{11}{3} \Big) \begin{bmatrix} 2 \\ 2 \\ 1 \end{bmatrix}
?
??
\vec{x}.\vec{y} = 1\times2 + 2\times2 + 5\times1 = 11
x.y=1×2+2×2+5×1=11\vec{x}.\vec{y} = 1\times2 + 2\times2 + 5\times1 = 11
\vec{y} = \begin{bmatrix} 2 \\ 2 \\ 1 \end{bmatrix}
y=[221]\vec{y} = \begin{bmatrix} 2 \\ 2 \\ 1 \end{bmatrix}
\vec{x} = \begin{bmatrix} 1 \\ 2 \\ 5 \end{bmatrix}
x=[125]\vec{x} = \begin{bmatrix} 1 \\ 2 \\ 5 \end{bmatrix}
= \begin{bmatrix} 7.33 \\ 7.33 \\ 3.66 \end{bmatrix}
=[7.337.333.66]= \begin{bmatrix} 7.33 \\ 7.33 \\ 3.66 \end{bmatrix}
\begin{bmatrix} 7.33 \\ 7.33 \\ 3.66 \end{bmatrix}
[7.337.333.66]\begin{bmatrix} 7.33 \\ 7.33 \\ 3.66 \end{bmatrix}

Vectors

What is a unit vector ?

(c) One Fourth Labs

Any vector whose magnitude is 1?

To obtain the unit vector in the direction of a non-unit vector, divide by the magnitude of the given vector.

|| (0, 1) || = \sqrt(0^2 + 1^2) = 1
(0,1)=(02+12)=1|| (0, 1) || = \sqrt(0^2 + 1^2) = 1
|| (1, 0) || = \sqrt(1^2 + 0^2) = 1
(1,0)=(12+02)=1|| (1, 0) || = \sqrt(1^2 + 0^2) = 1
|| (\frac{1}{\sqrt{2}}, \frac{1}{\sqrt{2}}) || = \sqrt((\frac{1}{\sqrt{2}})^2 + (\frac{1}{\sqrt{2}})^2) = 1
(12,12)=((12)2+(12)2)=1|| (\frac{1}{\sqrt{2}}, \frac{1}{\sqrt{2}}) || = \sqrt((\frac{1}{\sqrt{2}})^2 + (\frac{1}{\sqrt{2}})^2) = 1

Any vector whose magnitude is 1?

|| (2, 1) || = \sqrt(2^2 + 1^2) = \sqrt5
(2,1)=(22+12)=5|| (2, 1) || = \sqrt(2^2 + 1^2) = \sqrt5
u(2, 1) = \frac{( 2, 1)}{\sqrt5}
u(2,1)=(2,1)5u(2, 1) = \frac{( 2, 1)}{\sqrt5}
u(2, 1) = (\frac{2}{\sqrt5}, \frac{1}{\sqrt5})
u(2,1)=(25,15)u(2, 1) = (\frac{2}{\sqrt5}, \frac{1}{\sqrt5})

Vectors

How do you compute the angle between two vectors ?

(c) One Fourth Labs

\vec{x} = \begin{bmatrix} 2 \\ 2 \end{bmatrix}
x=[22]\vec{x} = \begin{bmatrix} 2 \\ 2 \end{bmatrix}
\vec{y} = \begin{bmatrix} 0 \\ 1 \end{bmatrix}
y=[01]\vec{y} = \begin{bmatrix} 0 \\ 1 \end{bmatrix}
\theta = ?
θ=?\theta = ?
\vec{x}.\vec{y} = ||\vec{x}||||\vec{y}||cos \theta
x.y=xycosθ\vec{x}.\vec{y} = ||\vec{x}||||\vec{y}||cos \theta
\vec{x}.\vec{y} =
x.y=\vec{x}.\vec{y} =
2\times0 + 2\times1
2×0+2×12\times0 + 2\times1
= 2
=2= 2
|\vec{x}| =
x=|\vec{x}| =
\sqrt{2^2 + 2^2}
22+22\sqrt{2^2 + 2^2}
= \sqrt{8}
=8= \sqrt{8}
|\vec{y}| =
y=|\vec{y}| =
\sqrt{0^2 + 1^2}
02+12\sqrt{0^2 + 1^2}
= \sqrt{1}
=1= \sqrt{1}
cos \theta = \frac{\vec{x}.\vec{y}}{||\vec{x}|| ||\vec{y}||}
cosθ=x.yxycos \theta = \frac{\vec{x}.\vec{y}}{||\vec{x}|| ||\vec{y}||}
\therefore
\therefore
cos \theta = \frac{2}{\sqrt{8} \sqrt{1}}
cosθ=281cos \theta = \frac{2}{\sqrt{8} \sqrt{1}}
cos \theta = \frac{1}{\sqrt{2}}
cosθ=12cos \theta = \frac{1}{\sqrt{2}}
\theta = 45 \degree
θ=45°\theta = 45 \degree
\theta = 45 \degree
θ=45°\theta = 45 \degree
cos \theta = \frac{\vec{x}.\vec{y}}{||\vec{x}|| ||\vec{y}||}
cosθ=x.yxycos \theta = \frac{\vec{x}.\vec{y}}{||\vec{x}|| ||\vec{y}||}
\theta = 45 \degree
θ=45°\theta = 45 \degree
\vec{x} = \begin{bmatrix} 2 \\ 2 \end{bmatrix}
x=[22]\vec{x} = \begin{bmatrix} 2 \\ 2 \end{bmatrix}
\vec{y} = \begin{bmatrix} 0 \\ 1 \end{bmatrix}
y=[01]\vec{y} = \begin{bmatrix} 0 \\ 1 \end{bmatrix}

Vectors

How do you compute the angle between two vectors ?

(c) One Fourth Labs

\vec{x} = \begin{bmatrix} 1 \\ 2 \\ 5 \end{bmatrix}
x=[125]\vec{x} = \begin{bmatrix} 1 \\ 2 \\ 5 \end{bmatrix}
\vec{y} = \begin{bmatrix} 2 \\ 2 \\ 1 \end{bmatrix}
y=[221]\vec{y} = \begin{bmatrix} 2 \\ 2 \\ 1 \end{bmatrix}
\theta = ?
θ=?\theta = ?
\vec{x}.\vec{y} = ||\vec{x}||||\vec{y}||cos \theta
x.y=xycosθ\vec{x}.\vec{y} = ||\vec{x}||||\vec{y}||cos \theta
\vec{x}.\vec{y} =
x.y=\vec{x}.\vec{y} =
1\times2 + 2\times2 + 5\times1
1×2+2×2+5×11\times2 + 2\times2 + 5\times1
= 11
=11= 11
|\vec{x}| =
x=|\vec{x}| =
\sqrt{1^2 + 2^2 + 5^2}
12+22+52\sqrt{1^2 + 2^2 + 5^2}
= \sqrt{30}
=30= \sqrt{30}
|\vec{y}| =
y=|\vec{y}| =
\sqrt{2^2 + 2^2 + 1^2}
22+22+12\sqrt{2^2 + 2^2 + 1^2}
= \sqrt{9}
=9= \sqrt{9}
\therefore
\therefore
cos \theta = \frac{11}{\sqrt{30} \sqrt{9}}
cosθ=11309cos \theta = \frac{11}{\sqrt{30} \sqrt{9}}
\theta = cos^{-1} (\frac{11}{\sqrt{9}\sqrt{30}}) \degree
θ=cos1(11930)°\theta = cos^{-1} (\frac{11}{\sqrt{9}\sqrt{30}}) \degree
\theta = cos^{-1} (\frac{11}{\sqrt{9}\sqrt{30}}) \degree
θ=cos1(11930)°\theta = cos^{-1} (\frac{11}{\sqrt{9}\sqrt{30}}) \degree
cos \theta = \frac{\vec{x}.\vec{y}}{||\vec{x}||||\vec{y}||}
cosθ=x.yxycos \theta = \frac{\vec{x}.\vec{y}}{||\vec{x}||||\vec{y}||}
cos \theta = \frac{\vec{x}.\vec{y}}{||\vec{x}||||\vec{y}||}
cosθ=x.yxycos \theta = \frac{\vec{x}.\vec{y}}{||\vec{x}||||\vec{y}||}
\theta = cos^{-1} (\frac{11}{\sqrt{9}\sqrt{30}}) \degree
θ=cos1(11930)°\theta = cos^{-1} (\frac{11}{\sqrt{9}\sqrt{30}}) \degree
\vec{x} = \begin{bmatrix} 1 \\ 2 \\ 5 \end{bmatrix}
x=[125]\vec{x} = \begin{bmatrix} 1 \\ 2 \\ 5 \end{bmatrix}
\vec{y} = \begin{bmatrix} 2 \\ 2 \\ 1 \end{bmatrix}
y=[221]\vec{y} = \begin{bmatrix} 2 \\ 2 \\ 1 \end{bmatrix}

Vectors

What are orthogonal vectors?

(c) One Fourth Labs

cos \theta = \frac{\vec{x}.\vec{y}}{||\vec{x}||||\vec{y}||}
cosθ=x.yxycos \theta = \frac{\vec{x}.\vec{y}}{||\vec{x}||||\vec{y}||}

- Orthogonal

\implies \theta = 90 \degree
    θ=90°\implies \theta = 90 \degree
\implies
    \implies

Perpendicular

\implies cos \theta = cos(90 \degree)
    cosθ=cos(90°)\implies cos \theta = cos(90 \degree)
\implies cos \theta = 0
    cosθ=0\implies cos \theta = 0
\implies \frac{\vec{x}.\vec{y}}{||\vec{x}||||\vec{y}||} = 0
    x.yxy=0\implies \frac{\vec{x}.\vec{y}}{||\vec{x}||||\vec{y}||} = 0
\implies \vec{x}.\vec{y} = 0
    x.y=0\implies \vec{x}.\vec{y} = 0

Vectors

What are orthogonal vectors?

(c) One Fourth Labs

\vec{x} = \begin{bmatrix} 1 \\ 2 \end{bmatrix}
x=[12]\vec{x} = \begin{bmatrix} 1 \\ 2 \end{bmatrix}
\vec{y} = \begin{bmatrix} 2 \\ -1 \end{bmatrix}
y=[21]\vec{y} = \begin{bmatrix} 2 \\ -1 \end{bmatrix}
cos \theta = \frac{\vec{x}.\vec{y}}{||\vec{x}||||\vec{y}||}
cosθ=x.yxycos \theta = \frac{\vec{x}.\vec{y}}{||\vec{x}||||\vec{y}||}
\vec{x}.\vec{y} =
x.y=\vec{x}.\vec{y} =
2 + (-2)
2+(2)2 + (-2)
= 0
=0= 0
|\vec{x}| =
x=|\vec{x}| =
\sqrt{1^2 + 2^2}
12+22\sqrt{1^2 + 2^2}
= \sqrt{5}
=5= \sqrt{5}
|\vec{y}| =
y=|\vec{y}| =
\sqrt{2^2 + (-1)^2}
22+(1)2\sqrt{2^2 + (-1)^2}
= \sqrt{5}
=5= \sqrt{5}
cos \theta = \frac{\vec{x}.\vec{y}}{||\vec{x}|| ||\vec{y}||}
cosθ=x.yxycos \theta = \frac{\vec{x}.\vec{y}}{||\vec{x}|| ||\vec{y}||}
\therefore
\therefore
cos \theta = \frac{0}{\sqrt{5} \sqrt{5}}
cosθ=055cos \theta = \frac{0}{\sqrt{5} \sqrt{5}}
cos \theta = 0
cosθ=0cos \theta = 0
\theta = 90 \degree
θ=90°\theta = 90 \degree
\theta = 90 \degree
θ=90°\theta = 90 \degree
\theta = 90 \degree
θ=90°\theta = 90 \degree
\vec{x} = \begin{bmatrix} 1 \\ 2 \end{bmatrix}
x=[12]\vec{x} = \begin{bmatrix} 1 \\ 2 \end{bmatrix}
\vec{y} = \begin{bmatrix} 2 \\ -1 \end{bmatrix}
y=[21]\vec{y} = \begin{bmatrix} 2 \\ -1 \end{bmatrix}

Vectors

What are orthogonal vectors?

(c) One Fourth Labs

cos \theta = \frac{\vec{x}.\vec{y}}{||\vec{x}||||\vec{y}||}
cosθ=x.yxycos \theta = \frac{\vec{x}.\vec{y}}{||\vec{x}||||\vec{y}||}
\vec{x} = \begin{bmatrix} 2 \\ 3 \\ 5 \end{bmatrix}
x=[235]\vec{x} = \begin{bmatrix} 2 \\ 3 \\ 5 \end{bmatrix}
\vec{y} = \begin{bmatrix} 1 \\ 6 \\ -4 \end{bmatrix}
y=[164]\vec{y} = \begin{bmatrix} 1 \\ 6 \\ -4 \end{bmatrix}
\vec{x}.\vec{y} =
x.y=\vec{x}.\vec{y} =
2 + 18 + (-20)
2+18+(20)2 + 18 + (-20)
= 0
=0= 0
|\vec{x}| =
x=|\vec{x}| =
\sqrt{2^2 + 3^2 + 5^2}
22+32+52\sqrt{2^2 + 3^2 + 5^2}
= \sqrt{38}
=38= \sqrt{38}
|\vec{y}| =
y=|\vec{y}| =
\sqrt{1^2 + 6^2 + (-4)^2}
12+62+(4)2\sqrt{1^2 + 6^2 + (-4)^2}
= \sqrt{53}
=53= \sqrt{53}
\therefore
\therefore
cos \theta = \frac{0}{\sqrt{38} \sqrt{53}}
cosθ=03853cos \theta = \frac{0}{\sqrt{38} \sqrt{53}}
cos \theta = \frac{\vec{x}.\vec{y}}{||\vec{x}||||\vec{y}||}
cosθ=x.yxycos \theta = \frac{\vec{x}.\vec{y}}{||\vec{x}||||\vec{y}||}
\theta = 90 \degree
θ=90°\theta = 90 \degree
\theta = 90 \degree
θ=90°\theta = 90 \degree
cos \theta = 0
cosθ=0cos \theta = 0
\theta = 90 \degree
θ=90°\theta = 90 \degree
\vec{x} = \begin{bmatrix} 2 \\ 3 \\ 5 \end{bmatrix}
x=[235]\vec{x} = \begin{bmatrix} 2 \\ 3 \\ 5 \end{bmatrix}
\vec{y} = \begin{bmatrix} 1 \\ 6 \\ -4 \end{bmatrix}
y=[164]\vec{y} = \begin{bmatrix} 1 \\ 6 \\ -4 \end{bmatrix}

Vectors

What are orthogonal vectors?

(c) One Fourth Labs

cos \theta = \frac{\vec{x}.\vec{y}}{||\vec{x}||||\vec{y}||}
cosθ=x.yxycos \theta = \frac{\vec{x}.\vec{y}}{||\vec{x}||||\vec{y}||}
\vec{x} = \begin{bmatrix} 1 \\ 2 \\ 1 \\ 2 \\ 3 \end{bmatrix}
x=[12123]\vec{x} = \begin{bmatrix} 1 \\ 2 \\ 1 \\ 2 \\ 3 \end{bmatrix}
\vec{y} = \begin{bmatrix} 0 \\ 1 \\ -2 \\ -3 \\ 2 \end{bmatrix}
y=[01232]\vec{y} = \begin{bmatrix} 0 \\ 1 \\ -2 \\ -3 \\ 2 \end{bmatrix}
\vec{x}.\vec{y} =
x.y=\vec{x}.\vec{y} =
0 + 2 + (-2) + (-6) + 6
0+2+(2)+(6)+60 + 2 + (-2) + (-6) + 6
= 0
=0= 0
|\vec{x}| =
x=|\vec{x}| =
\sqrt{1^2 + 2^2 + 1^2 + 2^2 + 3^2}
12+22+12+22+32\sqrt{1^2 + 2^2 + 1^2 + 2^2 + 3^2}
= \sqrt{19}
=19= \sqrt{19}
|\vec{y}| =
y=|\vec{y}| =
\sqrt{0^2 + 1^2 + (-2)^2 + (-3)^2 + 2^2}
02+12+(2)2+(3)2+22\sqrt{0^2 + 1^2 + (-2)^2 + (-3)^2 + 2^2}
= \sqrt{18}
=18= \sqrt{18}
\therefore
\therefore
cos \theta = \frac{0}{\sqrt{19} \sqrt{18}}
cosθ=01918cos \theta = \frac{0}{\sqrt{19} \sqrt{18}}
cos \theta = \frac{\vec{x}.\vec{y}}{||\vec{x}||||\vec{y}||}
cosθ=x.yxycos \theta = \frac{\vec{x}.\vec{y}}{||\vec{x}||||\vec{y}||}
\theta = 90 \degree
θ=90°\theta = 90 \degree
cos \theta = 0
cosθ=0cos \theta = 0

Vectors

Why do we care about them ?

(c) One Fourth Labs

\begin{bmatrix} 151 & 5.8 & 1 & 1 & 3060 & 15000 & 64 \end{bmatrix}
[1515.81130601500064]\begin{bmatrix} 151 & 5.8 & 1 & 1 & 3060 & 15000 & 64 \end{bmatrix}
\begin{bmatrix} 165 & 72 & 60000 & 3 & 32 & 5 \end{bmatrix}
[16572600003325]\begin{bmatrix} 165 & 72 & 60000 & 3 & 32 & 5 \end{bmatrix}
\mathbb{R}^{1 \times 7}
R1×7\mathbb{R}^{1 \times 7}
\mathbb{R}^{1 \times 6}
R1×6\mathbb{R}^{1 \times 6}
\begin{bmatrix} 0 & 1 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & ... & 1 \end{bmatrix}
[010111001...1]\begin{bmatrix} 0 & 1 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & ... & 1 \end{bmatrix}
\mathbb{R}^{1 \times 784}
R1×784\mathbb{R}^{1 \times 784}

Matrices

What are they ?

(c) One Fourth Labs

\begin{bmatrix} 1 \\ 2 \\ 3 \end{bmatrix}
[123]\begin{bmatrix} 1 \\ 2 \\ 3 \end{bmatrix}
\begin{bmatrix} 1 & 4\\ 2 & 5\\ 3 & 6 \end{bmatrix}
[142536]\begin{bmatrix} 1 & 4\\ 2 & 5\\ 3 & 6 \end{bmatrix}
\begin{bmatrix} 1 & 4 & 7\\ 2 & 5 & 8\\ 3 & 6 & 9 \end{bmatrix}
[147258369]\begin{bmatrix} 1 & 4 & 7\\ 2 & 5 & 8\\ 3 & 6 & 9 \end{bmatrix}

column vector

row vector

Matrices

How do you add two matrices ?

(c) One Fourth Labs

\begin{bmatrix} 1 & 4 & 7 \\ 2 & 5 & 8 \\ 3 & 6 & 9 \end{bmatrix}
[147258369]\begin{bmatrix} 1 & 4 & 7 \\ 2 & 5 & 8 \\ 3 & 6 & 9 \end{bmatrix}
\begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{bmatrix}
[123456789]\begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{bmatrix}
\begin{bmatrix} ? & ? & ? \\ ? & ? & ? \\ ? & ? & ? \end{bmatrix}
[?????????]\begin{bmatrix} ? & ? & ? \\ ? & ? & ? \\ ? & ? & ? \end{bmatrix}
+
++
=
==
\begin{bmatrix} 2 & ? & ? \\ ? & ? & ? \\ ? & ? & ? \end{bmatrix}
[2????????]\begin{bmatrix} 2 & ? & ? \\ ? & ? & ? \\ ? & ? & ? \end{bmatrix}
\begin{bmatrix} 2 & 6 & ? \\ ? & ? & ? \\ ? & ? & ? \end{bmatrix}
[26???????]\begin{bmatrix} 2 & 6 & ? \\ ? & ? & ? \\ ? & ? & ? \end{bmatrix}
\begin{bmatrix} 2 & 6 & 10 \\ ? & ? & ? \\ ? & ? & ? \end{bmatrix}
[2610??????]\begin{bmatrix} 2 & 6 & 10 \\ ? & ? & ? \\ ? & ? & ? \end{bmatrix}
\begin{bmatrix} 2 & 6 & 10 \\ 6 & 10 & 14 \\ 10 & 14 & 18 \end{bmatrix}
[261061014101418]\begin{bmatrix} 2 & 6 & 10 \\ 6 & 10 & 14 \\ 10 & 14 & 18 \end{bmatrix}
\begin{bmatrix} ? & ? & ? \\ ? & ? & ? \\ ? & ? & ? \end{bmatrix}
[?????????]\begin{bmatrix} ? & ? & ? \\ ? & ? & ? \\ ? & ? & ? \end{bmatrix}
\begin{bmatrix} 2 & ? & ? \\ ? & ? & ? \\ ? & ? & ? \end{bmatrix}
[2????????]\begin{bmatrix} 2 & ? & ? \\ ? & ? & ? \\ ? & ? & ? \end{bmatrix}
\begin{bmatrix} 2 & 6 & ? \\ ? & ? & ? \\ ? & ? & ? \end{bmatrix}
[26???????]\begin{bmatrix} 2 & 6 & ? \\ ? & ? & ? \\ ? & ? & ? \end{bmatrix}

Matrices

How do you multiply a matrix with a vector ?

(c) One Fourth Labs

\begin{bmatrix} 1 & 3 \\ 2 & 4 \end{bmatrix}
[1324]\begin{bmatrix} 1 & 3 \\ 2 & 4 \end{bmatrix}
\begin{bmatrix} 5 \\ 6 \end{bmatrix}
[56]\begin{bmatrix} 5 \\ 6 \end{bmatrix}
\times
×\times
\begin{bmatrix} ? \\ ? \end{bmatrix}
[??]\begin{bmatrix} ? \\ ? \end{bmatrix}
=
==
\begin{bmatrix} ? \\ ? \end{bmatrix}
[??]\begin{bmatrix} ? \\ ? \end{bmatrix}
\begin{bmatrix} (1 \times 5) + (3 \times 6) \\ ? \end{bmatrix}
[(1×5)+(3×6)?]\begin{bmatrix} (1 \times 5) + (3 \times 6) \\ ? \end{bmatrix}
\begin{bmatrix} 23 \\ ? \end{bmatrix}
[23?]\begin{bmatrix} 23 \\ ? \end{bmatrix}
\begin{bmatrix} 23 \\ (2 \times 5) + (4 \times 6) \end{bmatrix}
[23(2×5)+(4×6)]\begin{bmatrix} 23 \\ (2 \times 5) + (4 \times 6) \end{bmatrix}
\begin{bmatrix} 23 \\ 34 \end{bmatrix}
[2334]\begin{bmatrix} 23 \\ 34 \end{bmatrix}
\begin{bmatrix} 23 \\ ? \end{bmatrix}
[23?]\begin{bmatrix} 23 \\ ? \end{bmatrix}

Matrices

How do you multiply a matrix with a vector ?

(c) One Fourth Labs

  • What happens when a matrix hits a vector?
  • The vector gets transformed into a new vector (it strays from its path).
  • The vector may also get scaled (elongated or shortened) in the process.
v = \begin{bmatrix} 5 \\ 6 \\ \end{bmatrix}
v=[56]v = \begin{bmatrix} 5 \\ 6 \\ \end{bmatrix}
M = \begin{bmatrix} 1 & 3 \\ 2 & 4 \\ \end{bmatrix}
M=[1324]M = \begin{bmatrix} 1 & 3 \\ 2 & 4 \\ \end{bmatrix}
Mv = \begin{bmatrix} 23 \\ 34 \\ \end{bmatrix}
Mv=[2334]Mv = \begin{bmatrix} 23 \\ 34 \\ \end{bmatrix}
M = \begin{bmatrix} 1 & 3 \\ 2 & 4 \\ \end{bmatrix}
M=[1324]M = \begin{bmatrix} 1 & 3 \\ 2 & 4 \\ \end{bmatrix}
v = \begin{bmatrix} 5 \\ 6 \\ \end{bmatrix}
v=[56]v = \begin{bmatrix} 5 \\ 6 \\ \end{bmatrix}

Matrices

How do you multiply a matrix with a vector ?

(c) One Fourth Labs

\begin{bmatrix} 1 & 0 & 3 \\ 3 & 1 & 1 \\ 0 & 2 & 2 \end{bmatrix}
[103311022]\begin{bmatrix} 1 & 0 & 3 \\ 3 & 1 & 1 \\ 0 & 2 & 2 \end{bmatrix}
\begin{bmatrix} 1 \\ 1 \\ 3 \end{bmatrix}
[113]\begin{bmatrix} 1 \\ 1 \\ 3 \end{bmatrix}
\begin{bmatrix} ? \\ ? \\ ? \end{bmatrix}
[???]\begin{bmatrix} ? \\ ? \\ ? \end{bmatrix}
\times
×\times
=
==
\begin{bmatrix} ? \\ ? \\ ? \end{bmatrix}
[???]\begin{bmatrix} ? \\ ? \\ ? \end{bmatrix}
\begin{bmatrix} (1 \times 1) + (0 \times 1) + (3 \times 3)\\ ? \\ ? \end{bmatrix}
[(1×1)+(0×1)+(3×3)??]\begin{bmatrix} (1 \times 1) + (0 \times 1) + (3 \times 3)\\ ? \\ ? \end{bmatrix}
\begin{bmatrix} 10 \\ ? \\ ? \end{bmatrix}
[10??]\begin{bmatrix} 10 \\ ? \\ ? \end{bmatrix}
\begin{bmatrix} 10\\ (3 \times 1) + (1 \times 1) + (1 \times 3) \\ ? \end{bmatrix}
[10(3×1)+(1×1)+(1×3)?]\begin{bmatrix} 10\\ (3 \times 1) + (1 \times 1) + (1 \times 3) \\ ? \end{bmatrix}
\begin{bmatrix} 10\\ 7\\ ? \end{bmatrix}
[107?]\begin{bmatrix} 10\\ 7\\ ? \end{bmatrix}
\begin{bmatrix} 10\\ 7\\ ? \end{bmatrix}
[107?]\begin{bmatrix} 10\\ 7\\ ? \end{bmatrix}
\begin{bmatrix} 10\\ 7 \\ (0 \times 1) + (2 \times 1) + (2 \times 3) \end{bmatrix}
[107(0×1)+(2×1)+(2×3)]\begin{bmatrix} 10\\ 7 \\ (0 \times 1) + (2 \times 1) + (2 \times 3) \end{bmatrix}
\begin{bmatrix} 10 \\ 7 \\ 8 \end{bmatrix}
[1078]\begin{bmatrix} 10 \\ 7 \\ 8 \end{bmatrix}

Matrices

How do you multiply a matrix with a vector ?

(c) One Fourth Labs

Mv = \begin{bmatrix} 10 \\ 7 \\ 8 \end{bmatrix}
Mv=[1078]Mv = \begin{bmatrix} 10 \\ 7 \\ 8 \end{bmatrix}
M = \begin{bmatrix} 1 & 0 & 3\\ 3 & 1 & 1\\ 0 & 2 & 2\\ \end{bmatrix}
M=[103311022]M = \begin{bmatrix} 1 & 0 & 3\\ 3 & 1 & 1\\ 0 & 2 & 2\\ \end{bmatrix}
v = \begin{bmatrix} 1 \\ 1 \\ 3 \end{bmatrix}
v=[113]v = \begin{bmatrix} 1 \\ 1 \\ 3 \end{bmatrix}

Similarly, in a 3D space, when a vector is hit by a matrix, it gets transformed into a new vector.

Matrices

How do you multiply a matrix with a vector ?

(c) One Fourth Labs

\begin{bmatrix} 1 & 0 & 3 \\ 3 & 1 & 1 \\ 0 & 2 & 5 \end{bmatrix}
[103311025]\begin{bmatrix} 1 & 0 & 3 \\ 3 & 1 & 1 \\ 0 & 2 & 5 \end{bmatrix}
\begin{bmatrix} 7 \\ 1 \end{bmatrix}
[71]\begin{bmatrix} 7 \\ 1 \end{bmatrix}
\times
×\times
=
==
\begin{bmatrix} ? \\ ? \\ ? \end{bmatrix}
[???]\begin{bmatrix} ? \\ ? \\ ? \end{bmatrix}
\begin{bmatrix} ? \\ ? \\ ? \end{bmatrix}
[???]\begin{bmatrix} ? \\ ? \\ ? \end{bmatrix}
\begin{bmatrix} (1 \times 7) + (0 \times 1) + (3 \times ?)\\ ? \\ ? \end{bmatrix}
[(1×7)+(0×1)+(3×?)??]\begin{bmatrix} (1 \times 7) + (0 \times 1) + (3 \times ?)\\ ? \\ ? \end{bmatrix}

illegal operation

Matrices

How do you multiply a matrix with a vector ?

(c) One Fourth Labs

\begin{bmatrix} 1 & 0 & 3 \\ 3 & 1 & 1 \end{bmatrix}
[103311]\begin{bmatrix} 1 & 0 & 3 \\ 3 & 1 & 1 \end{bmatrix}
\begin{bmatrix} 7 \\ 1 \\ 2 \end{bmatrix}
[712]\begin{bmatrix} 7 \\ 1 \\ 2 \end{bmatrix}
\times
×\times
=
==
\begin{bmatrix} ? \\ ? \end{bmatrix}
[??]\begin{bmatrix} ? \\ ? \end{bmatrix}
\begin{bmatrix} ? \\ ? \end{bmatrix}
[??]\begin{bmatrix} ? \\ ? \end{bmatrix}
\begin{bmatrix} (1 \times 7) + (0 \times 1) + (3 \times 2)\\ ? \end{bmatrix}
[(1×7)+(0×1)+(3×2)?]\begin{bmatrix} (1 \times 7) + (0 \times 1) + (3 \times 2)\\ ? \end{bmatrix}
\begin{bmatrix} 13 \\ ? \end{bmatrix}
[13?]\begin{bmatrix} 13 \\ ? \end{bmatrix}
\begin{bmatrix} 13 \\ (3 \times 7) + (1 \times 1) + (1 \times 2) \end{bmatrix}
[13(3×7)+(1×1)+(1×2)]\begin{bmatrix} 13 \\ (3 \times 7) + (1 \times 1) + (1 \times 2) \end{bmatrix}
\begin{bmatrix} 13 \\ 24 \end{bmatrix}
[1324]\begin{bmatrix} 13 \\ 24 \end{bmatrix}

legal operation

 Conclusion : Number of columns in the matrix should be the same as the number of rows in the vector.

\begin{bmatrix} 13 \\ ? \end{bmatrix}
[13?]\begin{bmatrix} 13 \\ ? \end{bmatrix}

Matrices

How do you multiply two matrices ?

(c) One Fourth Labs

\begin{bmatrix} 1 & 0 & 3 \\ 3 & 1 & 1 \\ 0 & 2 & 5 \end{bmatrix}
[103311025]\begin{bmatrix} 1 & 0 & 3 \\ 3 & 1 & 1 \\ 0 & 2 & 5 \end{bmatrix}
\begin{bmatrix} 0 & 1 & 2\\ 3 & 0 & 5 \\ 1 & 2 & 1 \end{bmatrix}
[012305121]\begin{bmatrix} 0 & 1 & 2\\ 3 & 0 & 5 \\ 1 & 2 & 1 \end{bmatrix}
\times
×\times
=
==
\begin{bmatrix} ? & ? & ? \\ ? & ? & ? \\ ? & ? & ? \end{bmatrix}
[?????????]\begin{bmatrix} ? & ? & ? \\ ? & ? & ? \\ ? & ? & ? \end{bmatrix}
\begin{bmatrix} 1 & 0 & 3 \\ 3 & 1 & 1 \\ 0 & 2 & 5 \end{bmatrix}
[103311025]\begin{bmatrix} 1 & 0 & 3 \\ 3 & 1 & 1 \\ 0 & 2 & 5 \end{bmatrix}
\times
×\times
\begin{bmatrix} 0 \\ 3 \\ 1 \end{bmatrix}
[031]\begin{bmatrix} 0 \\ 3 \\ 1 \end{bmatrix}
=
==
\begin{bmatrix} 3 \\ 4 \\ 11 \end{bmatrix}
[3411]\begin{bmatrix} 3 \\ 4 \\ 11 \end{bmatrix}
\begin{bmatrix} ? & ? & ? \\ ? & ? & ? \\ ? & ? & ? \end{bmatrix}
[?????????]\begin{bmatrix} ? & ? & ? \\ ? & ? & ? \\ ? & ? & ? \end{bmatrix}
\begin{bmatrix} ? & ? & ? \\ ? & ? & ? \\ ? & ? & ? \end{bmatrix}
[?????????]\begin{bmatrix} ? & ? & ? \\ ? & ? & ? \\ ? & ? & ? \end{bmatrix}
\begin{bmatrix} ? & ? & ? \\ ? & ? & ? \\ ? & ? & ? \end{bmatrix}
[?????????]\begin{bmatrix} ? & ? & ? \\ ? & ? & ? \\ ? & ? & ? \end{bmatrix}
\begin{bmatrix} 1 & 0 & 3 \\ 3 & 1 & 1 \\ 0 & 2 & 5 \end{bmatrix}
[103311025]\begin{bmatrix} 1 & 0 & 3 \\ 3 & 1 & 1 \\ 0 & 2 & 5 \end{bmatrix}
\times
×\times
\begin{bmatrix} 0 \\ 3 \\ 1 \end{bmatrix}
[031]\begin{bmatrix} 0 \\ 3 \\ 1 \end{bmatrix}
=
==
\begin{bmatrix} 3 & ? & ? \\ 4 & ? & ? \\ 11 & ? & ? \end{bmatrix}
[3??4??11??]\begin{bmatrix} 3 & ? & ? \\ 4 & ? & ? \\ 11 & ? & ? \end{bmatrix}
\begin{bmatrix} 7 \\ 5 \\ 10 \end{bmatrix}
[7510]\begin{bmatrix} 7 \\ 5 \\ 10 \end{bmatrix}
\begin{bmatrix} 3 & ? & ? \\ 4 & ? & ? \\ 11 & ? & ? \end{bmatrix}
[3??4??11??]\begin{bmatrix} 3 & ? & ? \\ 4 & ? & ? \\ 11 & ? & ? \end{bmatrix}
\begin{bmatrix} 1 & 0 & 3 \\ 3 & 1 & 1 \\ 0 & 2 & 5 \end{bmatrix}
[103311025]\begin{bmatrix} 1 & 0 & 3 \\ 3 & 1 & 1 \\ 0 & 2 & 5 \end{bmatrix}
\times
×\times
\begin{bmatrix} 1 \\ 0 \\ 2 \end{bmatrix}
[102]\begin{bmatrix} 1 \\ 0 \\ 2 \end{bmatrix}
=
==
\begin{bmatrix} 1 & 0 & 3 \\ 3 & 1 & 1 \\ 0 & 2 & 5 \end{bmatrix}
[103311025]\begin{bmatrix} 1 & 0 & 3 \\ 3 & 1 & 1 \\ 0 & 2 & 5 \end{bmatrix}
\begin{bmatrix} 1 \\ 0 \\ 2 \end{bmatrix}
[102]\begin{bmatrix} 1 \\ 0 \\ 2 \end{bmatrix}
=
==
\begin{bmatrix} 3 & ? & ? \\ 4 & ? & ? \\ 11 & ? & ? \end{bmatrix}
[3??4??11??]\begin{bmatrix} 3 & ? & ? \\ 4 & ? & ? \\ 11 & ? & ? \end{bmatrix}
\times
×\times
\begin{bmatrix} 3 & ? & ? \\ 4 & ? & ? \\ 11 & ? & ? \end{bmatrix}
[3??4??11??]\begin{bmatrix} 3 & ? & ? \\ 4 & ? & ? \\ 11 & ? & ? \end{bmatrix}
\begin{bmatrix} 3 & 7 & ? \\ 4 & 5 & ? \\ 11 & 10 & ? \end{bmatrix}
[37?45?1110?]\begin{bmatrix} 3 & 7 & ? \\ 4 & 5 & ? \\ 11 & 10 & ? \end{bmatrix}
\begin{bmatrix} 3 & 7 & ? \\ 4 & 5 & ? \\ 11 & 10 & ? \end{bmatrix}
[37?45?1110?]\begin{bmatrix} 3 & 7 & ? \\ 4 & 5 & ? \\ 11 & 10 & ? \end{bmatrix}
\begin{bmatrix} 3 & 7 & ? \\ 4 & 5 & ? \\ 11 & 10 & ? \end{bmatrix}
[37?45?1110?]\begin{bmatrix} 3 & 7 & ? \\ 4 & 5 & ? \\ 11 & 10 & ? \end{bmatrix}
\begin{bmatrix} 3 & 7 & ? \\ 4 & 5 & ? \\ 11 & 10 & ? \end{bmatrix}
[37?45?1110?]\begin{bmatrix} 3 & 7 & ? \\ 4 & 5 & ? \\ 11 & 10 & ? \end{bmatrix}
\begin{bmatrix} 1 & 0 & 3 \\ 3 & 1 & 1 \\ 0 & 2 & 5 \end{bmatrix}
[103311025]\begin{bmatrix} 1 & 0 & 3 \\ 3 & 1 & 1 \\ 0 & 2 & 5 \end{bmatrix}
\times
×\times
=
==
\begin{bmatrix} 2 \\ 5 \\ 1 \end{bmatrix}
[251]\begin{bmatrix} 2 \\ 5 \\ 1 \end{bmatrix}
\begin{bmatrix} 5 \\ 12 \\ 15 \end{bmatrix}
[51215]\begin{bmatrix} 5 \\ 12 \\ 15 \end{bmatrix}
\begin{bmatrix} 1 & 0 & 3 \\ 3 & 1 & 1 \\ 0 & 2 & 5 \end{bmatrix}
[103311025]\begin{bmatrix} 1 & 0 & 3 \\ 3 & 1 & 1 \\ 0 & 2 & 5 \end{bmatrix}
\times
×\times
=
==
\begin{bmatrix} 2 \\ 5 \\ 1 \end{bmatrix}
[251]\begin{bmatrix} 2 \\ 5 \\ 1 \end{bmatrix}
\begin{bmatrix} 3 & 7 & 5 \\ 4 & 5 & 12 \\ 11 & 10 & 15 \end{bmatrix}
[3754512111015]\begin{bmatrix} 3 & 7 & 5 \\ 4 & 5 & 12 \\ 11 & 10 & 15 \end{bmatrix}

Matrices

How do you multiply two matrices ?

(c) One Fourth Labs

\begin{bmatrix} 1 & 0 & 3 \\ 3 & 1 & 1 \\ 0 & 2 & 5 \end{bmatrix}
[103311025]\begin{bmatrix} 1 & 0 & 3 \\ 3 & 1 & 1 \\ 0 & 2 & 5 \end{bmatrix}
\begin{bmatrix} 0 & 1 & 2\\ 3 & 0 & 1 \end{bmatrix}
[012301]\begin{bmatrix} 0 & 1 & 2\\ 3 & 0 & 1 \end{bmatrix}
\times
×\times
=
==
\begin{bmatrix} ? & ? & ? \\ ? & ? & ? \\ ? & ? & ? \end{bmatrix}
[?????????]\begin{bmatrix} ? & ? & ? \\ ? & ? & ? \\ ? & ? & ? \end{bmatrix}

Number of columns in the matrix is not equal to the number of rows in the vector.

\begin{bmatrix} 1 & 0 & 3 \\ 3 & 1 & 1 \\ 0 & 2 & 5 \end{bmatrix}
[103311025]\begin{bmatrix} 1 & 0 & 3 \\ 3 & 1 & 1 \\ 0 & 2 & 5 \end{bmatrix}
\begin{bmatrix} 0 \\ 3 \end{bmatrix}
[03]\begin{bmatrix} 0 \\ 3 \end{bmatrix}
\times
×\times
=
==

Matrices

How do you multiply two matrices ?

(c) One Fourth Labs

\begin{bmatrix} 1 & 0 \\ 3 & 1 \\ 0 & 2 \end{bmatrix}
[103102]\begin{bmatrix} 1 & 0 \\ 3 & 1 \\ 0 & 2 \end{bmatrix}
\begin{bmatrix} 0 & 1 & 2 & 4\\ 3 & 0 & 1 & 0 \end{bmatrix}
[01243010]\begin{bmatrix} 0 & 1 & 2 & 4\\ 3 & 0 & 1 & 0 \end{bmatrix}
\times
×\times
=
==
\begin{bmatrix} ? & ? & ? & ? \\ ? & ? & ? & ? \\ ? & ? & ? & ? \end{bmatrix}
[????????????]\begin{bmatrix} ? & ? & ? & ? \\ ? & ? & ? & ? \\ ? & ? & ? & ? \end{bmatrix}
\begin{bmatrix} 1 & 0 \\ 3 & 1 \\ 0 & 2 \end{bmatrix}
[103102]\begin{bmatrix} 1 & 0 \\ 3 & 1 \\ 0 & 2 \end{bmatrix}
\times
×\times
\begin{bmatrix} 0\\ 3 \end{bmatrix}
[03]\begin{bmatrix} 0\\ 3 \end{bmatrix}
=
==

Number of columns in the matrix is equal to the number of rows in the vector.

\begin{bmatrix} 1 & 0 \\ 3 & 1 \\ 0 & 2 \end{bmatrix}
[103102]\begin{bmatrix} 1 & 0 \\ 3 & 1 \\ 0 & 2 \end{bmatrix}
\times
×\times
\begin{bmatrix} 0\\ 3 \end{bmatrix}
[03]\begin{bmatrix} 0\\ 3 \end{bmatrix}
=
==
\begin{bmatrix} 1 & 0 \\ 3 & 1 \\ 0 & 2 \end{bmatrix}
[103102]\begin{bmatrix} 1 & 0 \\ 3 & 1 \\ 0 & 2 \end{bmatrix}
\times
×\times
\begin{bmatrix} 0\\ 3 \end{bmatrix}
[03]\begin{bmatrix} 0\\ 3 \end{bmatrix}
=
==
\begin{bmatrix} 0 \\ 3 \\ 6 \end{bmatrix}
[036]\begin{bmatrix} 0 \\ 3 \\ 6 \end{bmatrix}
\begin{bmatrix} 0 & 1 & 2 & 4 \\ 3 & 3 & 7 & 12 \\ 6 & 0 & 2 & 0 \end{bmatrix}
[0124337126020]\begin{bmatrix} 0 & 1 & 2 & 4 \\ 3 & 3 & 7 & 12 \\ 6 & 0 & 2 & 0 \end{bmatrix}
\begin{bmatrix} ? & ? & ? & ? \\ ? & ? & ? & ? \\ ? & ? & ? & ? \end{bmatrix}
[????????????]\begin{bmatrix} ? & ? & ? & ? \\ ? & ? & ? & ? \\ ? & ? & ? & ? \end{bmatrix}
\begin{bmatrix} ? & ? & ? & ? \\ ? & ? & ? & ? \\ ? & ? & ? & ? \end{bmatrix}
[????????????]\begin{bmatrix} ? & ? & ? & ? \\ ? & ? & ? & ? \\ ? & ? & ? & ? \end{bmatrix}
\begin{bmatrix} ? & ? & ? & ? \\ ? & ? & ? & ? \\ ? & ? & ? & ? \end{bmatrix}
[????????????]\begin{bmatrix} ? & ? & ? & ? \\ ? & ? & ? & ? \\ ? & ? & ? & ? \end{bmatrix}
\begin{bmatrix} 0 & ? & ? & ? \\ 3 & ? & ? & ? \\ 6 & ? & ? & ? \end{bmatrix}
[0???3???6???]\begin{bmatrix} 0 & ? & ? & ? \\ 3 & ? & ? & ? \\ 6 & ? & ? & ? \end{bmatrix}
\begin{bmatrix} ? & ? & ? & ? \\ ? & ? & ? & ? \\ ? & ? & ? & ? \end{bmatrix}
[????????????]\begin{bmatrix} ? & ? & ? & ? \\ ? & ? & ? & ? \\ ? & ? & ? & ? \end{bmatrix}

Matrices

How do you multiply two matrices ?

(c) One Fourth Labs

\begin{bmatrix} a_{11} & a_{12} & ... & a_{1n} \\ a_{21} & a_{22} & ... & a_{2n} \\ ... & ... & ... & ...\\ a_{m1} & a_{m2} & ... & a_{mn} \end{bmatrix}
[a11a12...a1na21a22...a2n............am1am2...amn]\begin{bmatrix} a_{11} & a_{12} & ... & a_{1n} \\ a_{21} & a_{22} & ... & a_{2n} \\ ... & ... & ... & ...\\ a_{m1} & a_{m2} & ... & a_{mn} \end{bmatrix}
\times
×\times
=
==

 Conclusion : Any m x n matrix can be multiplied with a n x k matrix to get a m x k output.

\begin{bmatrix} b_{11} & ... & b_{1k} \\ ... & ... & ... \\ b_{n1} & ... & b_{nk} \end{bmatrix}
[b11...b1k.........bn1...bnk]\begin{bmatrix} b_{11} & ... & b_{1k} \\ ... & ... & ... \\ b_{n1} & ... & b_{nk} \end{bmatrix}
\begin{bmatrix} c_{11} & ... & c_{1k} \\ c_{21} & ... & c_{2k} \\ ... & ... & ... \\ c_{m1} & ... & c_{mk} \end{bmatrix}
[c11...c1kc21...c2k.........cm1...cmk]\begin{bmatrix} c_{11} & ... & c_{1k} \\ c_{21} & ... & c_{2k} \\ ... & ... & ... \\ c_{m1} & ... & c_{mk} \end{bmatrix}

Matrices

Is there an alternate way of multiplying matrices ?

(c) One Fourth Labs

\begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \\ \end{bmatrix}
[a11a12a21a22]\begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \\ \end{bmatrix}
\begin{bmatrix} b_{11} \\ b_{21} \\ \end{bmatrix}
[b11b21]\begin{bmatrix} b_{11} \\ b_{21} \\ \end{bmatrix}
\times
×\times
=
==
\begin{bmatrix} a_{11} \times b_{11} + a_{12} \times b_{21} \\ a_{21} \times b_{11} + a_{22} \times b_{21} \\ \end{bmatrix}
[a11×b11+a12×b21a21×b11+a22×b21]\begin{bmatrix} a_{11} \times b_{11} + a_{12} \times b_{21} \\ a_{21} \times b_{11} + a_{22} \times b_{21} \\ \end{bmatrix}
\begin{bmatrix} a_{11} \\ a_{21} \\ \end{bmatrix}
[a11a21]\begin{bmatrix} a_{11} \\ a_{21} \\ \end{bmatrix}
\begin{bmatrix} a_{12} \\ a_{22} \\ \end{bmatrix}
[a12a22]\begin{bmatrix} a_{12} \\ a_{22} \\ \end{bmatrix}
b_{11}
b11b_{11}
\times
×\times
b_{21}
b21b_{21}
\times
×\times
+
++
=
==

Matrices

Is there an alternate way of multiplying matrices ?

(c) One Fourth Labs

\begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \\ \end{bmatrix}
[a11a12a21a22]\begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \\ \end{bmatrix}
\begin{bmatrix} b_{11} & b_{12} \\ b_{21} & b_{22} \\ \end{bmatrix}
[b11b12b21b22]\begin{bmatrix} b_{11} & b_{12} \\ b_{21} & b_{22} \\ \end{bmatrix}
\times
×\times
=
==
\begin{bmatrix} a_{11} \times b_{11} + a_{12} \times b_{21} & a_{11} \times b_{12} + a_{12} \times b_{22} \\ a_{21} \times b_{11} + a_{22} \times b_{21} & a_{21} \times b_{12} + a_{22} \times b_{22} \end{bmatrix}
[a11×b11+a12×b21a11×b12+a12×b22a21×b11+a22×b21a21×b12+a22×b22]\begin{bmatrix} a_{11} \times b_{11} + a_{12} \times b_{21} & a_{11} \times b_{12} + a_{12} \times b_{22} \\ a_{21} \times b_{11} + a_{22} \times b_{21} & a_{21} \times b_{12} + a_{22} \times b_{22} \end{bmatrix}
\begin{bmatrix} a_{11} \times b_{11} + a_{12} \times b_{21} \\ a_{21} \times b_{11} + a_{22} \times b_{21} \end{bmatrix}
[a11×b11+a12×b21a21×b11+a22×b21]\begin{bmatrix} a_{11} \times b_{11} + a_{12} \times b_{21} \\ a_{21} \times b_{11} + a_{22} \times b_{21} \end{bmatrix}
\begin{bmatrix} a_{11} \times b_{12} + a_{12} \times b_{22} \\ a_{21} \times b_{12} + a_{22} \times b_{22} \end{bmatrix}
[a11×b12+a12×b22a21×b12+a22×b22]\begin{bmatrix} a_{11} \times b_{12} + a_{12} \times b_{22} \\ a_{21} \times b_{12} + a_{22} \times b_{22} \end{bmatrix}
=
==
\begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \\ \end{bmatrix}
[a11a12a21a22]\begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \\ \end{bmatrix}
\begin{bmatrix} b_{11} \\ b_{21} \end{bmatrix}
[b11b21]\begin{bmatrix} b_{11} \\ b_{21} \end{bmatrix}
\times
×\times
\begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \\ \end{bmatrix}
[a11a12a21a22]\begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \\ \end{bmatrix}
\begin{bmatrix} b_{12} \\ b_{22} \end{bmatrix}
[b12b22]\begin{bmatrix} b_{12} \\ b_{22} \end{bmatrix}
\times
×\times
=
==
\begin{bmatrix} a_{11} \times b_{11} & a_{11} \times b_{12} \\ a_{21} \times b_{11} & a_{21} \times b_{12} \end{bmatrix}
[a11×b11a11×b12a21×b11a21×b12]\begin{bmatrix} a_{11} \times b_{11} & a_{11} \times b_{12} \\ a_{21} \times b_{11} & a_{21} \times b_{12} \end{bmatrix}
\begin{bmatrix} a_{12} \times b_{21} & a_{12} \times b_{22} \\ a_{22} \times b_{21} & a_{22} \times b_{22} \end{bmatrix}
[a12×b21a12×b22a22×b21a22×b22]\begin{bmatrix} a_{12} \times b_{21} & a_{12} \times b_{22} \\ a_{22} \times b_{21} & a_{22} \times b_{22} \end{bmatrix}
=
==
+
++
\begin{bmatrix} a_{11} \\ a_{21} \end{bmatrix}
[a11a21]\begin{bmatrix} a_{11} \\ a_{21} \end{bmatrix}
\begin{bmatrix} a_{12} \\ a_{22} \end{bmatrix}
[a12a22]\begin{bmatrix} a_{12} \\ a_{22} \end{bmatrix}
\begin{bmatrix} b_{11} & b_{12} \end{bmatrix}
[b11b12]\begin{bmatrix} b_{11} & b_{12} \end{bmatrix}
\begin{bmatrix} b_{21} & b_{22} \end{bmatrix}
[b21b22]\begin{bmatrix} b_{21} & b_{22} \end{bmatrix}
\times
×\times
\times
×\times
+
++
=
==

Matrices

What is the common operation that you will see in this course ?

(c) One Fourth Labs

W \ \ x \ \ + \ \ b
W  x  +  bW \ \ x \ \ + \ \ b
\mathbb{R}^{m \times n}
Rm×n\mathbb{R}^{m \times n}
\mathbb{R}^{? \times ?}
R?×?\mathbb{R}^{? \times ?}
\mathbb{R}^{? \times ?}
R?×?\mathbb{R}^{? \times ?}
\mathbb{R}^{n \times 1}
Rn×1\mathbb{R}^{n \times 1}
\mathbb{R}^{m \times 1}
Rm×1\mathbb{R}^{m \times 1}
Weight (g) Screen Size(in.) Dual SIM Radio Battery (mAh) Price (INR) Internal Memory (GB)
151 5.8 1 1 3060 15000 64
180 6.18 1 0 3500 32000 64
160 5.84 0 0 3060 25000 64
205 6.2 0 1 5000 18000 64
162 5.9 0 1 3000 14000 64
182 6.26 1 1 4000 12000 64
138 4.7 0 0 1960 35000 64
185 6.41 1 0 3700 42000 64
170 5.5 0 0 3260 44000 64

Why do we care about them ?

(c) One Fourth Labs

Matrices

\mathbb{R}^{9 \times 7}
R9×7\mathbb{R}^{9 \times 7}

Why do we care about them ?

(c) One Fourth Labs

Matrices

\begin{bmatrix} 151 & 5.8 & 1 & 1 & 3060 & 15000 & 64 \\ 180 & 6.18 & 1 & 0 & 3500 & 32000 & 64 \\ 160 & 5.84 & 0 & 0 & 3060 & 25000 & 64 \\ 205 & 6.2 & 0 & 1 & 5000 & 18000 & 64 \\ 162 & 5.9 & 0 & 1 & 3000 & 14000 & 64 \\ 182 & 6.26 & 1 & 1 & 4000 & 12000 & 64 \\ 138 & 4.7 & 0 & 0 & 1960 & 35000 & 64 \\ 185 & 6.41 & 1 & 0 & 3700 & 42000 & 64 \\ 170 & 5.5 & 0 & 0 & 3260 & 44000 & 64 \\ \end{bmatrix}
[1515.811306015000641806.1810350032000641605.8400306025000642056.201500018000641625.901300014000641826.2611400012000641384.700196035000641856.4110370042000641705.50032604400064]\begin{bmatrix} 151 & 5.8 & 1 & 1 & 3060 & 15000 & 64 \\ 180 & 6.18 & 1 & 0 & 3500 & 32000 & 64 \\ 160 & 5.84 & 0 & 0 & 3060 & 25000 & 64 \\ 205 & 6.2 & 0 & 1 & 5000 & 18000 & 64 \\ 162 & 5.9 & 0 & 1 & 3000 & 14000 & 64 \\ 182 & 6.26 & 1 & 1 & 4000 & 12000 & 64 \\ 138 & 4.7 & 0 & 0 & 1960 & 35000 & 64 \\ 185 & 6.41 & 1 & 0 & 3700 & 42000 & 64 \\ 170 & 5.5 & 0 & 0 & 3260 & 44000 & 64 \\ \end{bmatrix}
F1 F2 F3 F4 F5 F6 Fn
\mathbb{R}^{9 \times 7}
R9×7\mathbb{R}^{9 \times 7}

Why do we care about them ?

(c) One Fourth Labs

Matrices

F1 F2 F3 F4 F5 F6 ... Fn
\begin{bmatrix} 0 & 1 & 1 & 0 & 0 & 0 & ... & 0 \\ 1 & 0 & 1 & 1 & 0 & 1 & ... & 1 \\ 0 & 0 & 0 & 0 & 0 & 0 & ... & 0 \\ 0 & 0 & 0 & 1 & 0 & 1 & ... & 1 \\ 0 & 1 & 0 & 1 & 1 & 1 & ... & 1 \\ 1 & 1 & 1 & 1 & 1 & 0 & ... & 0 \\ 0 & 0 & 0 & 0 & 1 & 0 & ... & 1 \\ 0 & 1 & 1 & 0 & 0 & 0 & ... & 1 \\ 1 & 0 & 0 & 0 & 1 & 0 & ... & 0 \\ 0 & 0 & 1 & 1 & 0 & 0 & ... & 0 \end{bmatrix}
[011000...0101101...1000000...0000101...1010111...1111110...0000010...1011000...1100010...0001100...0]\begin{bmatrix} 0 & 1 & 1 & 0 & 0 & 0 & ... & 0 \\ 1 & 0 & 1 & 1 & 0 & 1 & ... & 1 \\ 0 & 0 & 0 & 0 & 0 & 0 & ... & 0 \\ 0 & 0 & 0 & 1 & 0 & 1 & ... & 1 \\ 0 & 1 & 0 & 1 & 1 & 1 & ... & 1 \\ 1 & 1 & 1 & 1 & 1 & 0 & ... & 0 \\ 0 & 0 & 0 & 0 & 1 & 0 & ... & 1 \\ 0 & 1 & 1 & 0 & 0 & 0 & ... & 1 \\ 1 & 0 & 0 & 0 & 1 & 0 & ... & 0 \\ 0 & 0 & 1 & 1 & 0 & 0 & ... & 0 \end{bmatrix}
\mathbb{R}^{10 \times 784}
R10×784\mathbb{R}^{10 \times 784}
Made with Slides.com