Identity Matrix
Inverse Matrix
Product of a Matrix and a Vector
Rotations
Rotation-Dilations
Orthogonal Projections
Reflections
Determinant and Inverse of a 2x2 Matrix
Matrix Products
|
Product of a Matrix and a Vector
How to Examples Exercise
How to:
Multiplying an MxN matrix (A) with an Nx1 column vector (x) results in an Mx1 column vector (y). Notice that the
number of columns in 'A' must directly equal the number of rows in 'x' or else we get an error. The number of
rows in 'A' will determine the number of rows in 'y', but will never cause an error. To compute the i-th row
of the vector y:
y(i, 1) = A(1, 1)*x(1, 1) + A(1, 2)*x(2, 1) + ... + A(1, n)*x(n, 1)
To do this more simply, in one step, MATLAB has made it so the '*' operator can apply directly to matrices and vectors:
y = A*x
IMPORTANT NOTE: Here, unlike in scalar multiplication, the order of our terms DOES matter. A*x is not the same
as x*A. In fact, trying to multiply x*A will cause an error as explained above.
Examples:
Let's find the product of R = [1 3; 2 5] and x = [5; 42] the step-by-step way, and then the one-step way.
We know the product of 'R' and 'x' will result in a 2x1 column vector which we'll call 'y'. Let's find the first row entry of 'y':
y(1, 1) = R(1, 1)*x(1, 1) + R(1, 2)*x(2, 1)
We find that y(1, 1) = 131. Now let's do the second (and final) row entry:
y(2, 1) = R(2, 1)*x(1, 2) + R(2, 2)*x(2, 2)
This gives us our product, y = [131; 220]
Now, let's try it the one-step way:
y = R*x
And we get the same answer, but doing the step-by-step method is important so you can see where the one-step way gets its
answer.
Exercise:
|