Upcoming SlideShare
×

# MELJUN CORTES - Matrix Algebra Mathematics of Computing

506 views

Published on

MELJUN CORTES - Matrix Algebra Mathematics of Computing

0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
506
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
15
0
Likes
0
Embeds 0
No embeds

No notes for slide

### MELJUN CORTES - Matrix Algebra Mathematics of Computing

1. 1. Year 1 LESSON 10 MATRIX ALGEBRA♦ Matrix definition • Rectangular array of numbers • Size of matrix is given by no of rows and no of columns • e.g. A = 2 x 3 matrix 2 9 16 1 0 -1 • e.g. B = 3 x 3 matrix 8 1 0 -1 0 1 4 1 5 CS113/0401/v1 Lesson 10 - 1
2. 2. Year 1 MATRIX ALGEBRA♦ Vectors • A single row matrix is called a row Vector – e.g. [ 5 9 1 2 ] • A single column matrix is called column vector 16 • e.g. 1 0 -1 CS113/0401/v1 Lesson 10 - 2
3. 3. Year 1 MATRIX OPERATION♦ Matrix Addition • Must be of same dimension • result is of same dimension E.g. A = 1 11 2 0 1 1 B = 2 0 1 1 0 2 1 11 2 2 0 1 A+B = 0 1 1 + 1 0 2 1+2 11+ 0 2+1 0+1 1+0 1+2 = 3 11 3 1 1 3 CS113/0401/v1 Lesson 10 - 3 =
4. 4. Year 1 MATRIX OPERATION♦ Matrix Subtraction • Same rule as matrix addition 1 11 2 e.g.A = 8 1 1 -2 0 1 B = 1 9 -2 1 11 2 -2 0 1 A-B = 8 1 1 + 1 9 -2 1+(-2) 11+ 0 2-1 8-1 1-9 1-(-2) = 3 11 1 = 7 -8 3 CS113/0401/v1 Lesson 10 - 4
5. 5. Year 1 MATRIX OPERATION♦ Matrix Multiplication • Scalar Multiplication e.g.A = 5 2 1 -1 5 2 2A = 2 1 -1 5x2 2x2 = 1x2 -1x2 = 10 4 2 -2 CS113/0401/v1 Lesson 10 - 5
6. 6. Year 1 MATRIX OPERATION♦ Matrix Multiplication • No of columns is 1st matrix must be equal no of rows in 2nd matrix • Result is of dimension – No of rows in 1st matrix by no of column in 2nd matrix e.g. If A is of dimension 2 x 3 B is of dimension 3 x 1 Then R=A * B is defined R is of dimension 2 x 1 CS113/0401/v1 Lesson 10 - 6
7. 7. Year 1 MATRIX OPERATION♦ Matrix Multiplication 3 1 A = 2 4 7 4 8 0 5 4 B = 3 2 11 1 R1 C1 3 1 8 0 5 4AB = 2 4 3 2 11 1 7 4 3x8+1x3 3x0+1x2 3x5+1x11 3x4+1x1 = 2x8+4x3 2x0+4x2 2x5+4x11 2x4+4x1 7x8+4x3 7x0+4x2 7x5+4x11 7x4+4x1 27 2 26 13 = 28 8 54 12 68 8 79 32 CS113/0401/v1 Lesson 10 - 7
8. 8. Year 1 UNITY MATRIX♦ In matrix algebra unity is any square matrix whose top left to bottom right diagonal consists of 1s where all the rest of the matrix consists of zeros 1 0 0 1 0 I= or I = 0 1 0 0 1 0 0 1 1 0 0 0 0 1 0 0 or I = 0 0 1 0 0 0 0 1♦ Matrices are only equal where they are the same size and have the same elements in the same place, i.e. 1 0 0 1 0 ≠ 0 1 0 0 1 0 0 1 CS113/0401/v1 Lesson 10 - 8
9. 9. Year 1 UNITY MATRIX♦ As wit normal numbers where a number multiplied by one equals itself (3 x 1 = 3) so with matrices, A matrix multiplied by the unity matrix equals itself, i.e. AI = A and IA = A 1 0 A= for example 0 1 1 0 1 6 1x1+6x0 0x6+0x3AI = x = 0 1 2 3 0x1+1x2 0x6+1x3 1 6 = 2 3Similarly 1 6 x 1 0 = 1x1+6x0 1x0+6x1IA = 2 3 0 1 2x1+3x0 2x0+3x1 = 1 6 2 3 thus proving that Al = IA = A Note: The unit matrix, I, must always be square. CS113/0401/v1 Lesson 10 - 9
10. 10. Year 1 EQUIVALENT MATRIX♦ Two matrices are equal if and only if their corresponding elements are equal. For instance, if A = 2 3 and B = 2 3 4 5 4 5 then matrix A = matrix B Example: x 2 3 -5 Given A = 1 y , B = 4 2 and C = 8 -3 5 0a. Find the values of x and y if A + B = Cb. Is BC + CB?c. Evaluate 3B CS113/0401/v1 Lesson 10 - 10
11. 11. Year 1 EQUIVALENT MATRIX♦ Solution: a. A +B = x 2 + 3 -5 1 y 4 2 = X+3 2-5 1+4 y+2 = X+3 -3 5 y+2Since A + B = C X+3 -3 = 8 -3 5 y+2 5 0 X-3 = 8 and y + 2 = 0Therefore x = 5, y = 2 CS113/0401/v1 Lesson 10 - 11
12. 12. Year 1 EQUIVALENT MATRIX♦ Solution: 3 -5 8 -3 b. BC = 4 2 5 0 = 24-25 -9+0 = -1 -9 32+10 -12+0 42 -12 8 -3 3 -5 CB = 5 0 4 2 24-12 -40-6 = 15+0 -25+0 12 -46 = 15 -25Thus BC = CB 3 -5 c. 3B = 3 4 2 = 3x3 3(-5) = 9 -15 3x4 3x2 12 6 CS113/0401/v1 Lesson 10 - 12
13. 13. Year 1 Exercise A group operates a chain of filling stations in each of which are employed cashiers, attendants and mechanics as shown Types of filling station Large Medium Small Cashier 4 2 1 Attendants 12 6 3 Mechanics 6 4 2 Matrix A, i.e. 3 x 3 The number of filling stations are Southern England Northern EnglandLarge stations 3 7Medium stations 5 8Small stations 12 4 Matrix B, i.e. 3 x 2 How many of the various types of staff are employed in Southern England and in Northern England? CS113/0401/v1 Lesson 10 - 13
14. 14. Year 1 SolutionA is a 3 x 3 matrix, B is a 3 x 2 matrixtherefore AB is feasible and will be a 3 x2 matrix. A x B = AB 4 2 1 3 7 X11 X12 12 6 3 5 8 X21 X22 6 4 2 12 4 X31 X32X11 = (4x3) + (2x5) + (1x12) = 34X12 = (4x7) + (2x8) + (1x4) = 48X21 = (12x3) + (6x5) + (3x12) = 102X22 = (12x7) + (4x5) + (3x4) = 144X31 = (6x3) + (4x5) + (2x12) = 62X32 = (6x7) + (4x8) + (2x4) = 82 AB is South North Cashiers 3 7 Attendants 5 8 Mechanics 12 4 CS113/0401/v1 Lesson 10 - 14
15. 15. Year 1 TRANSFORMATIONA transformation is an operation whichtransform a point or a figure into anotherpoint or figure. TranslationA translation is a transformation whichmoves all points in a place through thesame direction.e.g. The triangle ABC has been transformed onto the triangle A”B”C” by a translation [ ] i.e. 3 squares to the right and 2 squares up inthe plane of the paper. y 6 C’ 5 4 A’ B’ 3 C 2 1 A B X 1 2 3 4 5 6 CS113/0401/v1 Lesson 10 - 15
16. 16. Year 1 TranslationPoint a is mapped onto A’ by atranslation 3 , denoted by T. 2 X X’ y + T = y’ 1 3 4 1 + 2 = 3 Enlargement (E)An enlargement with centre O, scalefactor k is a transformation whichenlarges a given figure by k times theoriginal size.If k > O, the given figure and its imageare on the same side of the centre ofenlargement O.If k > O, the given figure and its imageare on opposite sides of O. CS113/0401/v1 Lesson 10 - 16
17. 17. Year 1 Enlargement (E)The figure and its image after anenlargement are similar, The scale factor K OA’ OB’ OC’= = = OA OB OC C’ C A’ o A B B’ Area of imageUnder an enlargement, = k2 Area of Figure If the image of a point (x,y) under a transformation is the point itself i.e. (x,y), the point (x,y) is called an invariant point of the transformation. If a line is mapped onto itself under a transformation, the line is said to be an invariant linr under the transformation. CS113/0401/v1 Lesson 10 - 17
18. 18. Year 1 ReflectionA reflection is a transformation whichreflects all points of a plane in a line( on the plane ) called the mirror line. ABC is mapped onto A’B’C’ under areflection in the line XY which is theperpendicular bisector of AA’, BB’ OR CC’.Under a reflection, the figure and its imageare congruent. xExample: C C’ B B’ A A’ Y CS113/0401/v1 Lesson 10 - 18
19. 19. Year 1 Rotation (R)A rotation is a transformation whichrotates all points on plane about a fixedpoint known as the centre of rotation,6through a given angle in anti-clockwiseof clockwise direction.The angle through which the points arerotated is called the angle of rotation.The triangle ABC is rotated about theorigin O through 90 in the anti-clockwisedirection, and mapped onto triangle A’B’C’. CS113/0401/v1 Lesson 10 - 19
20. 20. Year 1 Shearing (H) A shear parallel to the x-axis is a transformation which moves a point (x,y) parallel to the x-axis through a distance ky, where k is the shear factor.OBC is mapped onto OB’C’ under a shear alongthe x-axis with factor k. OC’ 6K = = = 2 OC 3 CS113/0401/v1 Lesson 10 - 20
21. 21. Year 1 Shearing (H) A shear parallel to the y-axis is a transformation which moves a point (x,y) parallel to the y-axis through a distance kx, where k is the shear factor. difference in y-coordinates of corresponding pointsk = x-coordinates of original point Stretching (S) ♦ One way stretch • A stretch parallel to the x-axis is a transformation which move a point (x,y) parallel to the x-axis, through a distance ky, where k is the stretch factor. • A stretch parallel to the y-axis is a transformation which moves a point (x,y) parallel to the y-axis through a distance ky, where k is the stretch factor. CS113/0401/v1 Lesson 10 - 21
22. 22. Year 1 Shearing (S) distance of new point the invariant linek = x-coordinates of original point In the case of stretching parallel to the x- axis, the invariant line is the x-axis. In the case of stretching parallel to the y- axis, the invariant line is the y-axis. CS113/0401/v1 Lesson 10 - 22
23. 23. Year 1 Shearing (S)♦ Two Way StretchIf a figure is stretched parallel to the x-axis as well as parallel to the y-axis, thenthe stretch is called a two-way stretch.Under a two-way stretch with h and k asconstants of stretch parallel to the x-axisand y-axis respectively a point (x,y) ismapped onto (hx,ky). CS113/0401/v1 Lesson 10 - 23
24. 24. Year 1 Shearing (S)Example: Matrix 1 3 represents a 2 -5 transformation T.Given (x,y) is the image of the point (a,b)under the transformation T, find x and y interms of a and b.Solution: Write the ordered pairs, (a,b) and (x,y) as column vectors: a x and b yPremultiply a by the matrix ,1 3 b 3 -5 x 1 3 awe get y = 2 -5 b 1xa + 3xb = 2xa + (-5)xb a + 3b = 2a -5bTherefore, x = a + 3b, y = 2a - 5b CS113/0401/v1 Lesson 10 - 24
25. 25. Year 1 Stretching (S)The matrix 1 3 defines a 2 -5transformation T which maps the points(a,b) onto ( a + 3b, 2a - 5b ).Example:Find the coordinates of the image of the point (-3,2) under the transformation represented by the matrix 3 -1 5 0Solution:Let the image of the point = (x,y) X 3 -1 -3 = y 5 0 2 3x(-3) + (-1)x2 = 5x(-3) + 0x2 -9-2 = -15+0 -11 = -15Therefore the images of the point = (-11,- 15) CS113/0401/v1 Lesson 10 - 25
26. 26. Year 1 Stretching (S)Example:Find the matrix of the transformation which maps (1,0 ) onto (4,1) and (0,1) onto (3,2).Solution:Let the matrix of transformation a b = c d(1,0) (4,1) 4 a b 1 1 = c d 0 because (4,1) is the image of (1,0) 4 a+0 1 = c+0 a = c CS113/0401/v1 Lesson 10 - 26