This is a short refresher provided by Udacity. It offers very clear instructions and tutorial. It only covers some basics of the linear algebra, so it really doesn't teach you anything meaningful in linear algebra.
It is very practical, however, in the instruction. The python code tutorial is very educational, at least for me, in terms of object-oriented programming and of implementing a math idea in code. So I have learned a lot from the coding experience, though not much for the knowledge.
This section talks about basic concepts of Points and Vectors.
- Point: Represent a Location, (x,y)
- Vector: Represent changes in locations, include magnitude and direction, [x, y, z]
- Point as a Vector: A point from the origin -> becomes a vector [x, y] = (x, y) - (0, 0)
This section talks about the basic operations of Vectors
Given two vectors
- Addition
- Geometrical Explanation: Connecting tail of
$\mathbf{w}$ to head of$\mathbf{v}$ , and the results is from the tail of$\mathbf{v}$ to the head of$\mathbf{w}$
- Geometrical Explanation: Connecting tail of
- Subtraction
- Geometrical Explanation: Connecting tails of
$\mathbf{w}$ and$\mathbf{v}$ , the results is from the head of$\mathbf{v}$ to the head of$\mathbf{w}$ - Use addition idea:
$\mathbf{w} + (\mathbf{v} - \mathbf{w}) = \mathbf{v}$
- Geometrical Explanation: Connecting tails of
- Scaling
- Geometrical Explanation: make the vector longer or shorter
- Length/Magnitude
-
More On Length
- n-dimension:
$||\mathbf{v}||^2 = \sum_i (x_i^2)$ - Unit Vector: a vector magnitude = 1
- Normalize a vector:
$\mathbf{v}_{normalized} = \mathbf{v} \cdot \frac{1}{||\mathbf{v}||}$ - 0-vector has no normalization
- 0-vector has no direction
- n-dimension:
-
Inner Product
-
More on Inner Product
- This can be used to calculate
$\theta$ given the dot product is known. - n-dimension:
$dot(\mathbf{v},\mathbf{w}) = v_1w_1 + v_2w_2 + ... v_nw_n$ - Cauchy-Schwart Inequality:
$|dot(\mathbf{v},\mathbf{w})| <= ||\mathbf{v}|| \times ||\mathbf{w}||$ - Geometrical Explanation
- If
$\mathbf{v} \neq 0, \mathbf{w} \neq 0$ $dot(\mathbf{v},\mathbf{w}) = ||\mathbf{v}|| ||\mathbf{w}|| \rightarrow \theta = 0$ $dot(\mathbf{v},\mathbf{w}) = -||\mathbf{v}|| ||\mathbf{w}|| \rightarrow \theta = 180$ $dot(\mathbf{v},\mathbf{w}) = 0 \rightarrow \theta = 90$
- If
- This can be used to calculate
-
Parallel and Orthogonal
- parallel ->
$\mathbf{v}$ is parallel to$a \cdot \mathbf{v}$ - orthogonal ->
$\mathbf{v}$ is parallel to$\mathbf{w}$ <==>$dot(\mathbf{v},w\mathbf{w}) = 0$ - 0 is parallel and orthogonal to v, for any v
- 0 is parallel and orthogonal to itself
- parallel ->
-
Projecting Vectors:
- Orthogonality: tools for decomposing objects into combinations of simpler objects in a structred way
-
$\mathbf{v}$ is probject on$\mathbf{b} \rightarrow proj_b(\mathbf{v}) = \mathbf{v} \cdot cos(\theta)$ $\mathbf{v} = \mathbf{v}^{parallel} + \mathbf{v}^{orthogonal}$ -
$\mathbf{u_b} = \mathbf{b} / ||\mathbf{b}||$ , so$\mathbf{u_b}$ is a unit vector $\mathbf{v}^{parallel} = \mathbf{v} \cdot \mathbf{u_b} = dot(dot(\mathbf{v}, u_b), u_b)$
-
Cross Products (only in 3D space)
$\mathbf{v} \times \mathbf{w} = ||\mathbf{v} || ||\mathbf{w} || \sin(\theta)$ - Geometrical Explanation:
- right thumb point to
$\mathbf{v} $ - right index point to
$\mathbf{v}$ - right middle point to
$\mathbf{v} \times \mathbf{w}$ - Direction and magnitude (only in 3D)
- Parallelgran: area of the the parallelgram of $\mathbf{v} $ and
$\mathbf{w}$ - area =
$||\mathbf{v} \times \mathbf{w}||$
- area =
- right thumb point to
- cross product is not symmetric
$\mathbf{\mathbf{v}} \times \mathbf{\mathbf{w}} = -(\mathbf{\mathbf{w}} \times \mathbf{\mathbf{v}} )$
This section talks about how to calculate intersections of vectors, planes, and high dimensional space. Equivalently, it talks about whether a linear equation system has one solution, infinite many solutions, or no solusions.
E.g. stock portofolio: consider two stocks
- weight of buying one of the stock:
$w_a + w_b = 1$ -
$\beta$ of each stock: measure of correlation of a stock's price movements with market movements:$\beta_a, \beta_b$ -
$\beta$ of the portofolio$\beta_{potrfolio} = w_a \beta_a + w_b \beta_b$ - it
$\beta_{portfolio} = 0$ , portfolio is uncorrelated with market
- it
- choose weights
$(w_a, w_b)$ , such that$\beta_a w_a + \beta_b w_b = 0$ - this is a line
- basepoint
$x_0$ (any point on the line) - direction
$\mathbf{v}$ (any scale) - any point on the line
$x(t) = x_0 + t\mathbf{v}$ (parameterization) -
$y = mx + b$ - basepoint
$x_0 = (0, b)$ - direction
$\mathbf{v} = [1, m]$
- basepoint
-
$Ax + By = k$ - basepoint:
$B \neq 0, x_0 = (0, k/B)$ $A \neq 0, x_0 = (k/A, 0)$
- direction:
$v =[B, -A]$ -
$(x,y)$ on$Ax + By = 0$ <=>$[x, y]$ orthogonal to$[A,B]$ -
$[A, B]$ is the normal vector of the line$Ax + By = k$
- basepoint:
- Parallel: two lines are parallel if their normal vectors are parallel
- concident line: infinitely many intersections
-
$p_1$ at$line_1$ ,$p_2$ at$line_2$ - Two parallel lines are equal <=> the vector connecting one point on each line is orthogonal to the lines' normal vectors
-
- no intersection: no intersections
- concident line: infinitely many intersections
- Intersection of
$$Ax + By = k_1$$ $$Cx + Dy = k_2$$
####Solving multiple lines intersection
- For example: three lines could have 0, 1, 2, 3 intersections
- Here we want to know whether multiple lines have a single common intersection
- Inconsistent: not a single consistant intersection
-
$Ax + By + Cz = k$ -
$[A, B, C] \cdot [x, y, z] = 0$ , for any point$(x,y,z)$ in the plane - for any point
$(x, y, z)$ on the plane,$[A, B, C]$ is orthogonal to$[x, y, z]$ -
$[A, B, C]$ is orthogonal to the plane, is the normal vector of the plane
-
- 2 parallel planes do not intersect
- parallel planes have parallel normal vectors
- two parallel planes are equal <=> the vector connecting one point on each plane is orthogonal to the plane's normal vectors
We know:
assume
- a line with direction vector
$cross.prod([A, B, C], [D, E, F])$ - no solution
- a plane of solution
Intersection between 3 planes
- a line
- no solution
- a plane
- a dot
Equations and geomatrical explanations
- One equation in two variables -> a line
- One equation in three variables -> a plane
-
Caution we have to count variables with coefficient = 0
-
$X + Y = 2$ -> define a line in 2D -
$X + Y + 0Z = 2$ -> defines a plane in 3D
-
Linear Operations that does not change the linear system
- Swap order of equations
- Multiple an equation by a number
$\alpha \neq 0$ on both sides - Add (a multiply of) an equation to another
Use the linear system operations to
-
Change the sub-space but does not change the intersection
-
each linear transformation is a transformation of sub-space
-
Special Cases
- No solution: original system is inconsistent
- Infinity number of solution:
- parametrize solution set
- Identify a pivot variable: a variable that is in a leading term when the system is in triangular form
- free variable: non-leading variable
- reduced row-echelon form (rref)