Vectors and Matrices PDF
Document Details
![EvaluativeCaesura](https://quizgecko.com/images/avatars/avatar-4.webp)
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