Programming Revision – 19/03/21

Matrix Multiplication

Matrix Multiplication is the dot product between each number.

1, 2, 3                                                                    2, 4, 6                                                    Pos1, Pos2, Pos3

4, 5, 6                                    x                              3, 6, 9                    =                             Pos4, Pos5, Pos6

7, 8, 9                                                                    4, 8, 12                                                  Pos7, Pos8, Pos9

Pos 1 = 1×2 + 2×4 + 3×6 = 2 + 8 + 18 = 28

Pos 2 = 2×2 + 2×4 + 2×6 = 4 + 8 + 12 = 24

Pos 3 = 3×2 + 3×4 + 3×6 = 6 + 12 + 18 = 36

Pos 4 = 4×3 + 4×6 + 4×9 = 12 + 24 + 36 = 72

Pos 5 = 5×3 + 5×6 + 5×9 = 15 + 30 + 45 = 90

Pos 6 = 6×3 + 6×6 + 6×9 = 18 + 36 + 54 = 108

Pos 7 = 7×4 + 7×8 + 7×12 = 28 + 56 + 84 = 168

Pos 8 = 8×4 + 8×8 + 8×12 = 32 + 64 + 96 = 192

Pos 9 = 9×4 + 9×8+ 9×12 = 36 + 72 + 108 = 226

28, 24, 36

72, 90, 108

168, 192, 226


Dot Products

Dot product is the cosine of the angle between 2 vectors, multiplied by the magnitude of each vector.

Cosine is the ratio of the side adjacent to an angle and the longest side (hypotenuse) in a right angled triangle.

Dot product is calculated by multiplying together the corresponding component from the 2 vectors and adding up the results.

(1,2) . (3,4)

1 x 3 = 3

2 x 4 = 8

3+8 = 11

________________

(-3, 6) . (2,3)

-3 x 2 = -6

6 x 3 = 18

-6 + 18 = 12

________________

(-1.5,4) . (-4, -0.8)

-1.5 x -4 = -6

4 x -0.8 = -3.2

-6 + -3.2 = -9.2

(2,4,6) . (-0.5, 0.5, -0.5)

2 x -0.5 = -1

4 x 0.5 = 2

6 x -0.5 = -3

-1 + 2 + -3 = -2


Cross Products

The result of a cross product is a new vector at 90 degrees.

Cross Products are a series of multiplications with 2 vectors.

(1,2,3,) – (4,5,6)

                                                     X                             Y                             Z

123123
456456

X = 2 x 6 – 3 x 5 = 12 – 15 = -3    Y = 3 x 4 – 1 x 6 = 12 – 6 = 6    Z = 1 x 5 – 2 x 4 = 5 – 8 = -3

(-3, 6, -3)


Averages (Mode, Median, Range, Mean)

Median refers to middle number in arranged order

if there is no middle, then the middle value of the 2 most middle numbers

Mode is the most common occurrence in a set of data

Range is the largest number minus the lowest number

Mean is all the numbers added together and divided by total numbers in sequence.


Remembering Pythag

SOH-CAH-TOA – The angle can be found in the following ways

Sine = Opposite / Hypotenuese

Cosine = Adjacent / Hypotenuese

Tangent = Opposite / Adjacent

Hypotenuse relates to the angle between the opposite and adjacent. The adjacent is the horizontal base of the triangle and the opposite is the vertical height of the triangle.

Sine, Cosine, Tangent

Leave a comment