BTEC NCF Dip in Comp - Unit 02 Fundamentals of Computer Systems Lesson 12 – Indices and Matrices Mr C Johnston.

Slides:



Advertisements
Similar presentations
Adding & Subtracting Matrices
Advertisements

HCI 530 : Seminar (HCI) Damian Schofield. HCI 530: Seminar (HCI) Transforms –Two Dimensional –Three Dimensional The Graphics Pipeline.
Section 4.1 – Matrix Operations Day 1
Fundamentals of matrices
Objective Video Example by Mrs. G Give It a Try Lesson 4.1  Add and subtract matrices  Multiply a matrix by a scalar number  Solve a matrix equation.
A Fast Introduction inverse matrix1 What is a matrix (One Matrix many matrices) Why do they exist Matrix Terminology Elements Rows Columns Square.
Further Pure 1 Solving Simultaneous equations. Simultaneous equations You have already learnt how to solve simultaneous equations at GCSE and AS level.
Chapter 7 Matrix Mathematics Matrix Operations Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
1.Every Person in your group needs a piece of paper, a pencil, graph paper, and a calculator. 2.Every Person in your group needs a letter, either T,
7 Days. Two days  p590 #2,5,11,13, , 26 NO TI.
Matrix Entry or element Rows, columns Dimensions Matrix Addition/Subtraction Scalar Multiplication.
Row 1 Row 2 Row 3 Row m Column 1Column 2Column 3 Column 4.
Matrices Addition & Subtraction Scalar Multiplication & Multiplication Determinants Inverses Solving Systems – 2x2 & 3x3 Cramer’s Rule.
Ch X 2 Matrices, Determinants, and Inverses.
Unit 6 : Matrices.
Unit 3: Matrices.
Identity and Equality Properties. Properties refer to rules that indicate a standard procedure or method to be followed. A proof is a demonstration of.
Class Opener:. Identifying Matrices Student Check:
4.5 Matrices, Determinants, Inverseres -Identity matrices -Inverse matrix (intro) -An application -Finding inverse matrices (by hand) -Finding inverse.
BELL RINGER  Yesterday you learned 3 different ways to solve systems of linear equations. Do you have a preference on how to solve systems? Explain.
MATRICES MATRIX OPERATIONS. About Matrices  A matrix is a rectangular arrangement of numbers in rows and columns. Rows run horizontally and columns run.
Algebra Matrix Operations. Definition Matrix-A rectangular arrangement of numbers in rows and columns Dimensions- number of rows then columns Entries-
Chapter 1. Introduction In this chapter we will: model relationships using variables, expressions, and equations. apply order of operations to simplify.
Revision on Matrices Finding the order of, Addition, Subtraction and the Inverse of Matices.
Multiply one equation, then add
3.5 Perform Basic Matrix Operations Add Matrices Subtract Matrices Solve Matric equations for x and y.
Unit 3: Matrices. Matrix: A rectangular arrangement of data into rows and columns, identified by capital letters. Matrix Dimensions: Number of rows, m,
Do Now: Perform the indicated operation. 1.). Algebra II Elements 11.1: Matrix Operations HW: HW: p.590 (16-36 even, 37, 44, 46)
Precalculus Section 14.1 Add and subtract matrices Often a set of data is arranged in a table form A matrix is a rectangular.
Matrices. Matrix - a rectangular array of variables or constants in horizontal rows and vertical columns enclosed in brackets. Element - each value in.
Warm-UP A = 7-310B = C =7-4Find:A 22 and C 31 97Find: the dimensions of each -88 Matrix Find: A + B and B – A and C + B.
A rectangular array of numeric or algebraic quantities subject to mathematical operations. The regular formation of elements into columns and rows.
Tell whether the matrix is equal to the fundraiser matrix. Explain.
Lesson 4 – Solving Simultaneous equations
A Fast Introduction What is a matrix (One Matrix many matrices)
Chapter 4 Matrices.
13.4 Product of Two Matrices
Introduction What is a matrix (One Matrix many matrices)
12-1 Organizing Data Using Matrices
Multiplying Matrices.
Chapter 4 Systems of Linear Equations; Matrices
Matrices Rules & Operations.
Chapter 7 Matrix Mathematics
Mr. Hartzer, Hamtramck High School
CS1550 Fundamentals For Computer Graphics Transformations-1
Warm-Up - 8/30/2010 Simplify. 1.) 2.) 3.) 4.) 5.)
Identity and Equality Properties
Matrix Operations Monday, August 06, 2018.
Matrix Operations.
Matrix Operations SpringSemester 2017.
Solving Matrix equations
Matrices.
WarmUp 2-3 on your calculator or on paper..
7.3 Matrices.
25. Basic matrix operations
4-2 Adding & Subtracting Matrices
4-1 Matrices and Data Warm Up Lesson Presentation Lesson Quiz
vms x Year 8 Mathematics Equations
L3 Numeracy Week 4 : Equations and Algebra
Dr Huw Owens Room B44 Sackville Street Building Telephone Number 65891
( ) ( ) ( ) ( ) Matrices Order of matrices
D2 Indices and matrices Matrix representation in computer systems:
Solving one- and two-step equations
Matrices.
Notebook Quiz #2: Complete on a separate sheet of paper.
Inverse of a Matrix Solving simultaneous equations.
1.8 Matrices.
Matrix Operations SpringSemester 2017.
1.8 Matrices.
BINGO Chapter 6 Review.
Presentation transcript:

BTEC NCF Dip in Comp - Unit 02 Fundamentals of Computer Systems Lesson 12 – Indices and Matrices Mr C Johnston

Learning Outcome Understand matrix representation in computer systems: the relationship between matrices and arrays mathematical operations using matrices single, two and multi-dimensional arrays row-major and column-major order

Matrices Introduction to Matrices A matrix is a rectangular collection of numbers which can be used in mathematical operations Matrices are used within may areas of computing including in the calculations for wire framing Matrices can have different dimensions depending on the application 1 dimension matrix: 1 row x cols 3 dimension matrix: x layers, x rows, x cols 2 dimension matrix: x rows x cols

Reading and Referencing Matrices Matrices – Elements, Order and Position Reading and Referencing Matrices Use co-ordinates to access elements (value) within a matrix Layer, Row, Column is the order of the co-ordinates (reference) 1 dimension matrix 3 dimension matrix 1 2 3 [0] 1 2 3 1 2 3 [0,2,1]th = 3 [2]th = 1 [1] 1 2 3 2 dimension matrix 1 2 3 1 2 3 [1,3,2]th = 7 1 2 3 [2] 1 2 3 1 2 3 [2,1,3]th = 2 [2,3]th = 5

Activity Complete this basic matrix exercise Matrix Fundamentals Dimensions & Elements Complete this basic matrix exercise

Calculations With Matrices - Addition Add each corresponding element together a 4 2 b c 5 7 d Y= a 8 -9 b c -3 3 d Z= a 4 2 b c 5 7 d a 8 -9 b c -3 3 d Y + Z= + Y + Z= a YA + ZA YB + ZB b c YC + ZC YD + ZD d Y + Z= a 4 + 8 2 + -9 b c 5 + -3 7 + 3 d Y + Z= a 12 -7 b c 2 10 d

Calculations With Matrices - Subtraction Matrices – Addition and Subtraction Calculations With Matrices - Subtraction Subtract each corresponding element a 4 2 b c 5 7 d Y= a 8 -9 b c -3 3 d Z= a 4 2 b c 5 7 d a 8 -9 b c -3 3 d Y - Z= - Y - Z= a YA – ZA YB - ZB b c YC - ZC YD – ZD d Y - Z= a 4 – 8 2 - -9 b c 5 - -3 7 – 3 d Y - Z= a -4 11 b c 8 4 d

Calculations With Matrices - Multiplication Multiply the rows of one matrix by the row of the other a 4 2 b c 5 7 d Y= a 8 c 5 Z= a 4 2 b c 5 7 d a 8 c 5 Y * Z= * Y * Z= a (YA * ZA) + (YB * ZC) c (YC * ZA) + (YD * ZC) Y * Z= a (4 * 8) + (2 * 5) c (5 * 8) + (7 * 5) Y * Z= a 32 + 10 c 40 +35 Y - Z= a 46 c 75

Activity Complete this basic maths matrix exercise

Transformation Matrices Used to transform shapes Multiply original co-ordinates by the transformation matrix to get the transformed co-ordinates To calculate the transformed x co-ordinate use the formula x = ax + by To calculate the transformed x co-ordinate use the formula y = cx + dy For complex shapes deal with each co-ordinate in a logical way – go round the shape in either CW or ACW direction Reflect in X-Axis Transformation a -1 b c 1 d Reflect in Y-Axis Transformation a 1 b c -1 d Reflect in Origin Transformation a -1 b c d Line y = x Transformation a -1 b c d Line x = y Transformation a 1 b c d

Transformation Matrices Example Reflect in X-Axis Transformation a -1 b c 1 d Original Co - Ordinates X 1 1 2 4 Y 1 3 4 2 (1,1) x = ax + by = -1*1 + 0*1 = -1 + 0 = -1 y = cx + dy = 0*1 + 1*1 = 0 + 1 = 1 (1,3) x = ax + by = -1*1 + 0*3 = -1 + 0 = -1 y = cx + dy = 0*1 + 1*3 = 0 + 3 = 3 (2,4) x = ax + by = -1*2 + 0*4 = -2 + 0 = -2 y = cx + dy = 0*2 + 1*4 = 0 + 4 = 4 Transformed Co - Ordinates X -1 -1 -2 -4 (4,2) x = ax + by = -1*4 + 0*1 = -4 + 0 = -4 y = cx + dy = 0*4 + 1*2 = 0 + 2 = 2 Y 1 3 4 2

Activity Transformation Matrices Transform this shape using the given transformation matrix. You must show your working out. Create a worksheet with 4 problems of your own. Show the answers to the questions with working on the reverse. Reflect in Y-Axis Transformation a 1 b c -1 d Original Co-Ordinates X Y Transformed Co-Ordinates X Y

Using Matrices to Solve Problems1 We can use matrices to work out simultaneous equations The equations need to be arrange in the format: <num1>X +/- <num2>Y = <num3> The numbers can then be represented as 2 x 2 and a 2 x 1 matrix Think of these two pairs of numbers 2x – 4 = 8y 5y + 2x = 10 Arrange them into the format <num1>X +/- <num2>Y = <num3> 2x – 8y = 4 2x + 5y = 10 This become in a matrix a 2 -8 b a X X = 4 * c 2 5 d c Y Y 10

Activity Rearranging Equations Expressing Simultaneous Equations as Matrices Practising rearranging these simultaneous equations into the format: <num1>X +/- <num2>Y = <num3> and then into a 2x2, 2x1 and answer matrix a b a = * c d c 2x + 13 = 5y b) 3x + 2y – 14 = 0 c) 5y -13 = 3x 3x + 4y - 15= 0 2x + 16 = 5y 2x + 3y – 4 = 0 d) x + 5y – 2 = 0 e) 4x + 3y + 10 = 0 f) 2x + 5y + 5 = 0 3y – 9 = 2x 5y – 18 = 2x 2y + 31 = 5x

Using Matrices to Solve Problems2 We now need to find out what X and Y, so using the rules of rearrangement we have to divide both sides by the matrix known To divide by a matrix we multiply by its inverse To invert a matrix we FIRST find the determinate using ad – bc, We then multiply the determinant by a modified matrix which has a and d swopped over and the signs changed of b and c a X c Y = 4 10 / a 2 -8 b c 5 d a 2 -8 b c 5 d a 5 8 b c -2 2 d original modified

Using Matrices to Solve Problems3 For division need to multiply by the determinate and the modified matrix a X c Y = 4 10 / a 2 -8 b c 5 d a X c Y  = Determinate * Modified Matrix * Known Matrix a X c Y 1 26 a 5 8 b c -2 2 d 4 10 1 ad-bc = Determinate = * * 1 (2*5) - (-8*2) = 1 26 a X c Y (5*4) + (8*10) (-2*4) +(2*10) = * 1 26 = 1 26 a X c Y 100 12 = * a 5 8 b c -2 2 d Modified Matrix = a X c Y 3.8 0.46 = Modify the order of the multiplication so its easiest… 1/26 of 5?? No thanks Modified Matrix – a and d swopped, sign changed in b and c

Activity Using the method shown solve these equations Solving Simultaneous Equations Using Matrices Using the method shown solve these equations 2x + 13 = 5y b) 3x + 2y – 14 = 0 c) 5y -13 = 3x 3x + 4y - 15= 0 2x + 16 = 5y 2x + 3y – 4 = 0 d) x + 5y – 2 = 0 e) 4x + 3y + 10 = 0 f) 2x + 5y + 5 = 0 3y – 9 = 2x 5y – 18 = 2x 2y + 31 = 5x Method Derive equations Rearrange equations Create matrices Calculate determinate Calculate modified matrix Carry out multiplication Check by substituting

Word Problem Example1 Taxi A charges £5 to get in and £1.50 a mile. Taxi B charges £3 to get in and £2 a mile. When does taxi A get cheaper than taxi B? TAXI A: COST = 5 + 1.50M TAXI B: COST = 3 + 2M Method Derive equations Rearrange equations Create matrices Calculate determinate Calculate modified matrix Carry out multiplication Check by substituting C = 5 + 1.50M C = 3 + 2M C - 1.50M = 5 C – 2M = 3 a 1 -1.5 b a C C = 5 * c 1 -2 d c M M 3

/ Word Problem Example2 =  1 -0.5 * * = 1 -0.5 * = 1 -0.5 * 1 -0.5 * C c M = 5 3 / a 1 -1.5 b c -2 d a C c M  = Determinate * Modified Matrix * Known Matrix 1 -0.5 a C c M a -2 1.5 b c -1 1 d 5 3 1 ad-bc = Determinate = * * 1 (1 * -2) - (-1.5*1) = 1 -0.5 a C c M (-2*5) + (1.5*3) (-1*5) +(1*3) = * 1 -0.5 = 1 -0.5 a C c M (-10) + (4.5) (-5) +(3) = * a -2 1.5 b c -1 1 d Modified Matrix = 1 -0.5 a C c M -5.5 -2 = * a C c M 11 4 =

Activity Using the method shown solve these problems Solving Simultaneous Equations Using Matrices Using the method shown solve these problems 9 pens and five pencils cost £5, and 7 pens and 8 pencils cost £3. Find the unit price for each pen and pencil. Drayton manor is a popular school trip destination. This year 11 at School A and the year 11 at High School B both planned trips there. School A rented filled 8 vans and 8 buses with 240 students. School B rented and filled 4 vans and 1 bus with 54 students. Every van had the same number of students in it as did the buses. Find the number of students in each van and in each bus. A rugby club is selling tickets to one of its games. On the first day of ticket sales the school sold 3 senior citizen tickets and 1 child ticket for a total of £38. The school took in £52 on the second day by selling 3 senior citizen tickets and 2 child tickets. Find the price of a senior citizen ticket and the price of a child ticket. Mr J writes test to check the understanding of his BTEC learners. The test has 25 questions for a total score of 150 points. Among the 25 questions, each multiple choice questions carries 3 points and the descriptive type questions carries 8 points. How many multiple choice questions and descriptive type questions are there in the test?

Arrays As Matrices In computing arrays are stored as matrices, however the co-ordinates start a row 0 and col 0 rather than row 1 an col 1 so referencing is slightly different 1 dimension array 3 dimension array 0 1 2 [0] 0 1 2 1 2 [0,1,0]th = 3 [1]th = 1 [1] 0 1 2 2 dimension array 1 2 0 1 2 [1,1,2]th = 7 1 2 [2] 0 1 2 1 2 [2,0,2]th = 2 [1,2]th = 5

Matrices in Memory There are two ways of storing Matrices in computer memory – row major order and column major order Within row major order matrices are stored in memory a row at a time, with the second row following the first Within column major order matrices are stored in memory a column at a time, with the second row following the first 4 E 2 7 ? A 3 4 E 2 7 ? A 2 3 4 E 2 7 ? A 3 4 7 E ? 2 2 A 3

Exam Question A computer system stores data in the matrices below. The data is written to memory using colum-major order. Quantity is written to array a. Price is written to array b. Calculate the outcome of the formula Total = Quantity*Price using the data in locations a[7] and b[4] Show your working out.