Linear algebra

Linear algebra

Matrix arithmetic

Addition and subtraction work for matrices of identical dimensions.

Multiplication works when the "inner two" dimensions are the same. Meaning: columns of first matrix = rows of second matrix.

The matrix multiplication A3x2 times B2x3 is defined. Putting the dimensions next to each other: 3x2 2x3 The "inner two" are the same.

To multiply, a visual aid is to raise the second matrix:

    1  0  0
    3  2  1
2 3
1 0
4 1

Then, for the first item, add the product of 2*1 and 3*3.

An identity matrix I, in Swedish denoted E, looks like this. The zeroes are shorthand for "there are zeroes all over here".

1     0
  1
    1
0     1

A square matrix has two possible properties:

  • EITHER its determinant is zero
  • OR it is invertible

Take two square matrices A and B. If AB = I and BA = I, they are inverses to each other. The inverse is unique. The inverse of A is denoted A-1.

Powers function like you expect: (AB)-1 = B-1 A-1 but only square matrices

Calculating a determinant - Sarrus' rule, Laplace utveckling, or Gauss-Jordan elimination

Calculating the inverse of a 2x2 matrix: determinant (ad-bc) times the adjugate.

Calculating the inverse of a 3x3 matrix:

Your original KhanAcademy method involves the determinant, the matrix of minors, the cofactor matrix and the adjugate matrix.

  • Matrix of minors is nine 2x2 determinants.
    • This produces something called the cofactor matrix.
  • Taking the transpose of the cofactor produces the adjugate matrix.
  • You know this. 1/det(A) times adj(A) produces the inverse to A, same as for 2x2 matrices.

The Gaussian method

  • Draw your matrix. Draw a vertical line. Draw the identity matrix on the other side.
  • Do elementary row operations, and whatever you do to the first matrix, you have to do to the identity matrix.
  • Goal: the first matrix should become the identity matrix.
  • Result: the original identity matrix has become the inverse matrix.

Determinants

Take a couple of 2x2 matrices, call them A and B. Say that

det(A) = -1 and
det(B) = -3.

What are the following?

det(AB) det(2A) det(A+) det((B2)-1) det(B5)

How to calculate a determinant:

You can Gauss it until you have a triangular matrix. Then the determinant is the product of the diagonal elements.

For a 2x2 matrix, the determinant is adbcad-bc .

Gauss-Jordan

Write a system of equations as a talschema (this is not a matrix). Reduce.

Elementary row-ops:

  1. Swap two rows
  2. Multiply row with something
  3. Add the expanded row to another row
Reduced row echelon form -- trappstegsform.
1 * * * * | *
    1 * * | *
      1 * | *
        1 | *

Each 1 in the diagram above is a "pivot".

Three possibilities

  1. There is a row 0 0 ... 0 | a. No solutions.
  2. There is a pivot in every column. One unique solution!
  3. There are columns without pivots. Infinite solutions.
  4. If there is a row 0 0 ... 0 | 0, you can just toss that row. 0=0 is true but adds no info.
  5. If there are two identical rows, you can toss one of them. It adds no info.

Vectors

Warning: Can have AB=CD\overline{AB} = \overline{CD} as vectors, but ABCD\overline{AB} \ne \overline{CD} as directed distances (riktade strackor).

Subtraction is tricky: get the order right. Take three points A, B, C. AB minus AC is what? Look at the minuend(?), AB. The thing being subtracted from is AB. Therefore, AB is pointing at the same point that the resulting vector will point at. So the resulting vector is CB: it goes from C to B.

If you ever have coordinates X, Y, neither of which are in the origin, you can point at either of them with vector addition. Take a point O in the origin and add OY to YX to get OX. Or add OX to XY to get OY.

Scalar product🔗

A scalar is just a number.

  • Multiplying a vector with a scalar obviously gives you a different vector.
  • Multiplying a vector by another vector gives you a scalar.

The scalar product of two vectors comes from multiplying them together like uv\vec{u} \cdot \vec{v} , so called because you get a scalar out of it. Different from Cross product. If the scalar product is zero, the vectors are orthogonal to each other. The algorithm is as follows (where φ is the angle between the vectors):

uv={uvcosϕif u0 and v00if u=0 or v=0 \vec{u} \cdot \vec{v} = \left\lbrace \begin{array}{ll} |\vec{u}| |\vec{v}| \cos \phi & \textrm{if } \vec{u} \ne 0 \textrm{ and } \vec{v} \ne 0 \\ 0 & \textrm{if } \vec{u} = 0 \textrm{ or } \vec{v} = 0 \end{array}\right.

The second clause is necessary because, though 0=0|\vec{0}| = 0 , any angle φ between a vector and the null vector is undefined, breaking the math.

You can see that if the angle is 90 degrees – i.e. they are orthogonal – the scalar product will be zero, because what is the cosine of 90 degrees?

Note, often in linear algebra, the angle between two objects indicates the smaller of the two possible angles – the pointy angle, so 0ϕπ0 \le \phi \le \pi .

A formula that does not use the angle, is this. Let u=(a,b)\vec{u} = (a,b) , and v=(x,y)\vec{v} = (x,y) . Then

uv=ax+by. \vec{u} \cdot \vec{v} = ax + by.

Cross product🔗

So named because a you get a vector out of it. Also called cross product. Only defined in 3D-space.

There is no "the" normal-vector of a plane. A normal-vector is determined by its direction, but its length can be whatever you like. As such, the cross product of two vectors within a plane is one possible normal to that plane.

To get the coordinates of a vector product, the practical method is this:

Let u=(a1,a2,a3)\vec{u} = (a_1, a_2, a_3) and v=(b1,b2,b3)\vec{v} = (b_1, b_2, b_3) . (Coordinates are given in a fixed ON-base, this time positively oriented). Then

u×v=e1 a2b2a3b3e2 a1b1a3b3+e3 a1b1a2b2. \vec{u} \times \vec{v} = \vec{e}_1 \ \begin{array}{|ll|} a_2 & b_2 \\ a_3 & b_3 \end{array} - \vec{e}_2 \ \begin{array}{|ll|} a_1 & b_1 \\ a_3 & b_3 \end{array} + \vec{e}_3 \ \begin{array}{|ll|} a_1 & b_1 \\ a_2 & b_2 \end{array} \, .

As a memory rule, you can use the nonsensical expression

u×v=e1a1b1e2a2b2e3a3b3, \vec{u} \times \vec{v} = \begin{array}{|lll|} \vec{e}_1 & a_1 & b_1 \\ \vec{e}_2 & a_2 & b_2 \\ \vec{e}_3 & a_3 & b_3 \end{array} \, ,

nonsensical because determinants shouldn't contain vectors, but it works here as a memory rule to produce the formula. Do not forget the negative sign in the formula.

Absolute value

The magnitude, or length of a vector, is calculated with the Pythagorean theorem.

Want to find the parallellogram between two vectors? Take the cross product of the two, and calculate the absolute value of it. It's the same as the determinant of the two.

Positive/negative orientation🔗

In two-dimensional space, two vectors u and v, create a positively oriented base if:

when you rotate the first vector, u, counter-clockwise, you can make it point in the same direction as v without rotating more than 180 degrees.

In three-dimensional space… imagine yourself perched on the top of the third vector, looking down at the plane made by the other two. Apply the above rules.

(VERIFY) Alternatively, you can use the hand rule:

Form your right hand so that your thumb, index and middle fingers are orthogonal to each other. May require some stretching of muscles.

You can pivot your hand any way you like, the point being… if your palm is facing upwards, your middle finger is pointing upwards, and the thumb to your right. Then the thumb should represent the x-axis (the first vector), the index finger the y-axis (the second vector), and the middle finger the z-axis (or a cross product of two vectors). Now that you've named your fingers, you can pivot the hand around.

If the vectors you are looking at don't follow that arrangement, they create a negatively oriented base(?).

ON-base

An orthonormal base is one where the base vectors are orthogonal to each other and have length 1.

There are several different ON-bases: it can be orientated all manner of ways. In particular, some rules are different if it has a "positive" versus "negative" orientation, see Positive/negative orientation.

Plane

If in R3 you have a plane x=0x = 0 , which can also be written 1x+0y+0z=01x + 0y + 0z = 0 , how does the plane look?

Think before you read on!

Does it matter what y or z are?

The plane doesn't give a shit about y or z, but x must be zero. So, at any point on the plane, x must be zero. That means, that the x-axis is orthogonal to our plane.

Good going! Now, find a normal to that plane. It is easy: pick any value of x: (1,0,0)(1,0,0) , for instance.

Notice how you can get that from reading the plane's equation: they are the coefficients to x, y, z.

You know that it is a normal because the Scalar product of orthogonal vectors should be zero, right? A vector (x,y,z)(x,y,z) within the plane multiplied with (1,0,0)(1,0,0) is zero. So an alternative way to express the equation of that plane is (x,y,z)(1,0,0)=0(x,y,z) \cdot (1,0,0) = 0 . IOW by writing this, we are considering all vectors (x,y,z)(x,y,z) whose dot product with (1,0,0)(1,0,0) is 0, and they all lie within that plane.

Let a new plane x+128=0x + 128 = 0 . You can express this as (x,y,z)(1,0,0)=128(x,y,z) \cdot (1,0,0) = -128 , or (x+128,y,z)(1,0,0)=0(x+128, y, z) \cdot (1,0,0) = 0 , so it is a plane parallel to x=0x=0 but that is -128 units away from it in the x direction.

Let a new plane 4x11y5z+128=04x - 11y - 5z + 128 = 0 . Once again, you can find a normal by taking the coefficients: (4,11,5)(4,-11,-5) , because the value of 4x11y5z+1284x-11y-5z+128 remains constant when you move perpendicularly to (4,11,5)(4, -11, -5) , by linearity and definition of perpendicularity.

Angle between lines

Use both ways to do the dot product. The only unknown becomes cosθ\cos \theta , which you can solve for.

Also, a trick is: the angle between two lines is the same as the angle between their normals. (Draw this)

Projection formula

To project the vector u on the vector v, the formula is

uvv2v \frac{u \cdot v}{|v|^2} v

Linear dependence

Look at R2. If you have two vectors pointing different directions, you can create any other vector in R2 by scaling those two and adding them to each other an appropriate amount of times.

If those two vectors are on the same line, you can only ever get another vector on that line. Make sense?

Zero vectors, regardless of scaling, can only produce another zero vector.

Now, you can extend this to higher dimensions. If two vectors are within a plane, there is no combination of those two vectors that can produce a vector poking out of the plane. It is said that any set of three vectors within the plane is a linearly dependent set, because the other two can be used to produce the third – there is redundancy.

A linearly independent set of three vectors within R3 is one where none of the vectors can be produced by a combination of the other two.

To check for linear dependence, e.g. to check if three vectors within space are in the same plane, put them in a determinant like so: det(u, v, w):

c1a1b1c2a2b2c3a3b3. \begin{array}{|lll|} c_1 & a_1 & b_1 \\ c_2 & a_2 & b_2 \\ c_3 & a_3 & b_3 \end{array} \, . If the determinant is zero, the vectors are linearly dependent.

Fundamental Theorem of Linear Algebra

determinant=0, system of equations solutions, invertability of matrix

Idempotent matrix

What links here

  • Math
Created (8 years ago)