Vectors and Matrices PDF
Document Details
Uploaded by EvaluativeCaesura
Tags
Summary
This document explains vectors and matrices, including vector addition, subtraction, and magnitude calculations. It also covers matrix operations like addition and subtraction, along with scalar multiplication. The mathematical concepts are presented with examples, figures, and formulas.
Full Transcript
IT2202 Vectors and Matrices A variety of mathematical operations can be performed with and upon vectors. Vectors The first operation is the addition of vecto...
IT2202 Vectors and Matrices A variety of mathematical operations can be performed with and upon vectors. Vectors The first operation is the addition of vectors. Given vectors 𝒗 = 〈𝒗𝟏 , 𝒗𝟐 〉 and A coordinate system is defined by an origin point and the orientation and scale 𝒘 = 〈𝒘𝟏 , 𝒘𝟐 〉, the formula shall be: of a set of coordinate axes. 𝒗 + 𝒘 = 〈𝒗𝟏 + 𝒘𝟏 , 𝒗𝟐 + 𝒘𝟐 〉 Sample Vector Addition: A point 𝒑 = (𝒙, 𝒚) refers to a location in space, specified relative to a 𝑣 = 〈2, 5〉 coordinate system. 𝑤 = 〈4, −2〉 A vector 𝒗 = 〈𝒎, 𝒏〉 refers to a displacement—an amount of change in each coordinate—and is typically drawn as an arrow pointing along the direction of 𝑣 + 𝑤 = 〈𝑣1 + 𝑤1 , 𝑣2 + 𝑤2 〉 displacement. The figure below shows three (3) vectors: 𝑣 + 𝑤 = 〈2 + 4, 5 + −2〉 𝑣 + 𝑤 = 〈6, 3〉 The result is a new vector 𝒖 = 𝒗 + 𝒘 that shares the initial point of v and the terminal point of w. Figure 1. A collection of vectors. Figure 2. Vector addition. Initial point or tail – the point where the arrow begins Vector subtraction is the same as addition with a negated second vector: Terminal point or head – the point where the arrow ends; indicates 𝑣 = 〈1, 2〉 the result when the displacement has been applied to the initial point. 𝑤 = 〈4, 5〉 Length or magnitude – the distance between the initial and terminal points of the vector; can be calculated from the components of the vector. 𝑣 + −𝑤 = 〈𝑣1 + (−𝑤1 ), 𝑣2 + (−𝑤2 )〉 𝑣 + −𝑤 = 〈1 + (−4), 2 + (−5)〉 Vectors are not associated with any particular location in space; the same 𝑣 + −𝑤 = 〈−3, −3〉 vector may exist at different locations. A vector whose initial point is located at Given the length of the two (2) sides (x, y), you can determine the the origin (when a coordinate system is specified) is said to be in standard length/magnitude of a vector using the Pythagorean theorem. position. ||𝒗|| = √𝒙𝟐 + 𝒚𝟐 Individual numbers (that are not part of a point or vector) are often called scalars. For example, the following computes the length of 𝒗 = 〈𝟒, 𝟐〉: ||𝑣|| = √42 + 22 = √16 + 4 = √20 = 𝟒. 𝟒𝟕 03 Handout 1 *Property of STI [email protected] Page 1 of 2 IT2202 Matrices can be added or subtracted only when they have the same number of dimensions. You can find the sum simply by adding the corresponding entries in matrices. 1 2 5 6 𝐴+𝐵 =[ ]+[ ] 3 4 7 8 1+5 2+6 =[ ] 3+7 4+8 6 8 =[ ] 10 12 The same rule applies to matrix subtraction: Figure 3. Sample graph showing a vector’s length. 4 2 2 4 𝐴−𝐵 =[ ]−[ ] 1 6 0 1 Matrices 4−2 2−4 A matrix is a rectangular array of values called elements that are typically =[ ] 1−0 6−1 accessed by means of subscripts. The first subscript refers to the row number, 2 −2 while the second one refers to the column number, with the subscripts starting =[ ] 1 5 at 0. The figure below shows an example of a 4x4 matrix. You can multiply a scalar by each element of the matrix using the dot operator. 𝐴00 𝐴01 𝐴02 𝐴03 This is known as scalar multiplication. 𝐴 𝐴11 𝐴12 𝐴13 1 2 2. 1 2. 2 2 4 [ 10 ] 2.[ ]=[ ]=[ ] 𝐴20 𝐴21 𝐴22 𝐴23 3 4 2. 3 2. 4 6 8 𝐴30 𝐴31 𝐴32 𝐴33 In matrix multiplication, you can only multiply matrices if the number of Figure 4. A 4x4 matrix. columns on the left-hand side matrix is equal to the number of rows on the right- hand side matrix. To multiply matrices, multiply the elements of each row of the The identity matrix contains all zeros, with ones along the diagonal. Any point first matrix by the elements of each column in the second matrix. Then, add the or matrix multiplied by the identity matrix is unchanged. products. 1 0 0 0 2 9 0 0 1 0 0 3 2 1 5 1 3 5 [ ] 𝐴.𝐵 = [ ].[ ] 0 0 1 0 9 1 3 0 2 4 7 0 0 0 1 8 1 5 Figure 5. A 4x4 identity matrix. 6 + 2 + 2 + 40 27 + 6 + 4 + 5 0 + 10 + 7 + 25 𝐴.𝐵 = [ ] 18 + 1 + 6 + 0 81 + 3 + 12 + 0 0 + 5 + 21 + 0 The transpose of a matrix is computed by interchanging its rows and columns. 50 42 42 𝐴00 𝐴01 𝐴02 𝐴03 𝐴00 𝐴10 𝐴20 𝐴30 =[ ] 25 96 26 𝐴 𝐴11 𝐴12 𝐴13 𝐴 𝐴11 𝐴21 𝐴31 [ 10 ] = [ 01 ] References: 𝐴20 𝐴21 𝐴22 𝐴23 𝐴02 𝐴12 𝐴22 𝐴32 Korites, B. (2018). Python graphics: A reference for creating 2D and 3D images. Apress. Marschner, S. & Shirley, P. (2021). Fundamentals of computer graphics (5th ed.). CRC Press. 𝐴30 𝐴31 𝐴32 𝐴33 𝐴03 𝐴13 𝐴23 𝐴33 Stemkoski, L. & Pascale, M. (2021). Developing graphics frameworks with Python and OpenGL. Figure 6. A transpose of a 4x4 matrix. CRC Press. 03 Handout 1 *Property of STI [email protected] Page 2 of 2