Multiplying A Matrix And A Vector

You are at:  Basic Concepts - Circuits -  Mathematical Background - Matrix-Vector Multiplication

Multiplying A Matrix And A Vector

Multiplying a matrix and a vector is a special case of matrix multiplication.  Circuit equations and state equations representing linear system dynamics contain products of a matrix and a vector.  In the first lesson on circuit analysis, equations that come about by writing node equations can be put into a vector-matrix representation that includes a term that is a matrix - the conductance matrix - multiplied by a vector - the vector of node voltages.  (Click here to go to that point in the lessons where that is presented.)

Since vector-matrix representations are encountered often in electrical engineering, you need to be very familiar with basic operations.  In this lesson, we will examine mutiplying a matrix and a vector.  In the basic lesson on circuits, we encountered this vector-matrix representation for the circuit below.  The form we are interested in is this.  We want to be able to evaluate a matrix vector product of this form whenever we encounter one. The algorithm for computing the product is best presented visually.  Here it is.

There are some things to remember about matrix-vector multiplication.

• The matrix is assumed to be N x M.  In other words:
• The matrix has N rows.
• The matrix has M columns.
• For example, a 2 x 3 matrix has 2 rows and 3 columns.
• In matrix-vector multiplication, if the matrix is N x M, then the vector must have a dimension, M.
• In other words, the vector will have M entries.
• If the matrix is 2 x 3, then the vector must be 3 dimensional.
• This is usually stated as saying the matrix and vector must be conformable.
• Then, if the matrix and vector are conformable, the product of the matrix and the vector is a resultant vector that has a dimension of N.  (So, the result could be a different size than the original vector!)
• For example, if the matrix is 2 x 3, and the vector is 3 dimensional, the result of the multiplication would be a vector of 2 dimensions.
It is possible to express the calculations mathematically.
• Let the matrix be represented by A.
• The elements of A are aij, where,
• i is the row index and takes on values from 1 to M.
• j is the column index and takes on values from 1 to N.
• Let the vector be represented by b.
• The elements of b are bj, where,
• j is the index and takes on values from 1 to N.
• The product is c = A*b,
• The product is a vector of length M.
Then, the calculation for the the terms in the product vector are given by: This expression just puts the process for calculating the product into standard mathematical form.  What it says to do is the following.

• To calculate the jth entry in the product vector.
• Multiply entries in the jth row of the matrix, A, by the corresponding entries in the vector, b, and sum all of the terms.
So, now you should be able to perform these calculations.  Let's look at some example problems.
Questions

Q1. For this matrix and vector, is the product defined?  Q2. For this matrix and vector, is the product defined?  Problems

P1  In this matrix-vector product, the result is a vector, c, with two components, c1 and c2.  Calculate the components of the product and enter your answer in the spaces below. First, calculate the value of c1
Enter your answer in the box below, then click the button to submit your answer.  You will get a grade on a 0 (completely wrong) to 100 (perfectly accurate answer) scale.

P1  Next, calculate the value of c2
Enter your answer in the box below, then click the button to submit your answer.

Finally,  we have a calculator you can use to avoid doing these kinds of problems by hand.  Here is the calculator.  Here's how to use the calculator.
• Determine the size of the matrix and enter N (#rows) and M (#columns).
• The maximum matrix size is 5 x 5.
• Create a matrix and a vector by clicking the button.  You will automatically get a conformable matrix and vector.
• Enter data into the matrix and vector.
• Click the button to multiply.

Problems