Skip to contentSkip to lesson map

Linear Combinations

Reading
MMAC Ch 3.2, pp 281-288
Practice
Optional HW 17 Q5, Q9, and Q13.
Lesson map

Objectives

  1. Define linear combination and which vector operations it may include.
  2. Compute a specified linear combination, by hand and in R.
  3. Rewrite a system of equations as an equivalent vector equation (and vice-versa).
  4. Given a vector equation, solve for the scalars of the linear combination by hand.
  5. Determine the size (rows and columns) of a given matrix.
  6. Compute the product of a vector and a matrix, or determine the product is undefined.

1. Linear Combinations

Objective. Define linear combination and which vector operations it may include.

The figure scales bu‾1=(21)\overline{\vphantom{b}u}_1 = \left(\begin{smallmatrix} 2\\1 \end{smallmatrix}\right) by 2 and bu‾2=(−12)\overline{\vphantom{b}u}_2 = \left(\begin{smallmatrix} -1\\2 \end{smallmatrix}\right) by 1, then adds the two scaled vectors tip to tail. The orange arrow from the origin to (3,4)(3, 4) is

2bu‾1+1bu‾2=(42)+(−12)=(34), 2\overline{\vphantom{b}u}_1 + 1\overline{\vphantom{b}u}_2 = \begin{pmatrix*}[r] 4 \\ 2 \end{pmatrix*} + \begin{pmatrix*}[r] -1 \\ 2 \end{pmatrix*} = \begin{pmatrix*}[r] 3 \\ 4 \end{pmatrix*},

a linear combination of bu‾1\overline{\vphantom{b}u}_1 and bu‾2\overline{\vphantom{b}u}_2.

Figure

Definition 1 (Linear combination).

If bu‾1,bu‾2,…,bu‾n\overline{\vphantom{b}u}_1, \overline{\vphantom{b}u}_2, \dots, \overline{\vphantom{b}u}_n are vectors and x1,x2,…,xnx_1, x_2, \dots, x_n are scalars, then x1bu‾1+x2bu‾2+⋯+xnbu‾nx_1\overline{\vphantom{b}u}_1 + x_2\overline{\vphantom{b}u}_2 + \dots + x_n\overline{\vphantom{b}u}_n is a linear combination of bu‾1,bu‾2,…,bu‾n\overline{\vphantom{b}u}_1, \overline{\vphantom{b}u}_2, \dots, \overline{\vphantom{b}u}_n.

The expression 2bu‾+32\overline{\vphantom{b}u} + 3 is not a linear combination, because its term 3 is a scalar with no vector. The definition adds only scalar multiples of vectors.

Allowed operations. A linear combination is built from scalar multiplication and vector addition. Vector subtraction is allowed, because bu‾−bv‾=bu‾+(−1)bv‾\overline{\vphantom{b}u} - \overline{\vphantom{b}v} = \overline{\vphantom{b}u} + (-1)\overline{\vphantom{b}v} is an addition with a scalar of −1-1.

Excluded operations. An expression that divides by a vector is not a linear combination, because division by a vector is undefined. The dot product bu‾⋅bv‾\overline{\vphantom{b}u}\cdot\overline{\vphantom{b}v}, defined on the Lesson 20 sheet, multiplies two vectors to give a scalar. A linear combination of vectors is always a vector, and a scalar such as bu‾⋅bv‾\overline{\vphantom{b}u}\cdot\overline{\vphantom{b}v} on its own is therefore not one.

Matching dimensions. Every vector in a linear combination has the same dimension.

Special cases. A single scaled vector such as −6bw‾-6\overline{\vphantom{b}w} is a linear combination with n=1n = 1. A plain sum such as bu‾+bv‾\overline{\vphantom{b}u} + \overline{\vphantom{b}v} is a linear combination with both scalars equal to 1.

Example 1

For the vectors

bp‾=(2−10),bq‾=(135),br‾=(4−2),bs‾=(01), \overline{\vphantom{b}p} = \begin{pmatrix*}[r] 2 \\ -1 \\ 0 \end{pmatrix*}, \quad \overline{\vphantom{b}q} = \begin{pmatrix*}[r] 1 \\ 3 \\ 5 \end{pmatrix*}, \quad \overline{\vphantom{b}r} = \begin{pmatrix*}[r] 4 \\ -2 \end{pmatrix*}, \quad \overline{\vphantom{b}s} = \begin{pmatrix*}[r] 0 \\ 1 \end{pmatrix*},

determine which of these expressions are linear combinations, where xx and yy are scalars:

5bp‾,2bp‾−br‾,xbr‾+ybs‾,bp‾⋅bq‾,br‾/bs‾,xbp‾+ybq‾−4bp‾. 5\overline{\vphantom{b}p}, \qquad 2\overline{\vphantom{b}p} - \overline{\vphantom{b}r}, \qquad x\overline{\vphantom{b}r} + y\overline{\vphantom{b}s}, \qquad \overline{\vphantom{b}p}\cdot\overline{\vphantom{b}q}, \qquad \overline{\vphantom{b}r}/\overline{\vphantom{b}s}, \qquad x\overline{\vphantom{b}p} + y\overline{\vphantom{b}q} - 4\overline{\vphantom{b}p}.
ShowHide solution
  • By the definition of a linear combination, the expression 5bp‾5\overline{\vphantom{b}p} is a linear combination, because it is one vector scaled by 5, the case n=1n = 1.
  • The expression 2bp‾−br‾2\overline{\vphantom{b}p} - \overline{\vphantom{b}r} is not a linear combination, because bp‾\overline{\vphantom{b}p} has dimension 3 and br‾\overline{\vphantom{b}r} has dimension 2.
  • The expression xbr‾+ybs‾x\overline{\vphantom{b}r} + y\overline{\vphantom{b}s} is a linear combination with unknown scalars.
  • The expression bp‾⋅bq‾\overline{\vphantom{b}p}\cdot\overline{\vphantom{b}q} is not a linear combination, because it is a single scalar (the Lesson 20 dot product).
  • The expression br‾/bs‾\overline{\vphantom{b}r}/\overline{\vphantom{b}s} is not a linear combination, because division by a vector is undefined.
  • The expression xbp‾+ybq‾−4bp‾x\overline{\vphantom{b}p} + y\overline{\vphantom{b}q} - 4\overline{\vphantom{b}p} is a linear combination, because it collects to (x−4)bp‾+ybq‾(x-4)\overline{\vphantom{b}p} + y\overline{\vphantom{b}q}.

Example 2

Each B-1B sortie carries the load bb‾=(816)\overline{\vphantom{b}b} = \left(\begin{smallmatrix} 8\\16 \end{smallmatrix}\right) and each B-52H sortie carries the load bh‾=(128)\overline{\vphantom{b}h} = \left(\begin{smallmatrix} 12\\8 \end{smallmatrix}\right), with the count of Joint Air-to-Surface Standoff Missiles (JASSM) first and the count of Guided Bomb Unit-31 (GBU-31) bombs second. Decide whether each quantity is a linear combination of bb‾\overline{\vphantom{b}b} and bh‾\overline{\vphantom{b}h}, and name the scalars of each one that is.

  • (a) The total load of three B-1B sorties and two B-52H sorties.
  • (b) The load of one B-52H sortie minus the load of one B-1B sortie.
  • (c) The number of JASSM per GBU-31 on one B-1B sortie.
ShowHide solution

(a) The total load is 3bb‾+2bh‾3\overline{\vphantom{b}b} + 2\overline{\vphantom{b}h}, a linear combination with scalars 3 and 2.

(b) The difference is bh‾−bb‾=(−1)bb‾+1bh‾\overline{\vphantom{b}h} - \overline{\vphantom{b}b} = (-1)\overline{\vphantom{b}b} + 1\overline{\vphantom{b}h}, a linear combination with scalars −1-1 and 1, because subtraction is addition with a scalar of −1-1.

(c) The ratio 8/16=0.58/16 = 0.5 divides one component by another and gives a single scalar. It is not a linear combination, because a linear combination of vectors is a vector.

Next: 2. Computing a Linear CombinationLesson map

2. Computing a Linear Combination

Objective. Compute a specified linear combination, by hand and in R.

In a specified linear combination, the vectors and the scalars are both given.

Example 3

Compute 3bu‾−2bv‾3\overline{\vphantom{b}u} - 2\overline{\vphantom{b}v} by hand, for

bu‾=(1−203),bv‾=(41−12). \overline{\vphantom{b}u} = \begin{pmatrix*}[r] 1 \\ -2 \\ 0 \\ 3 \end{pmatrix*}, \quad \overline{\vphantom{b}v} = \begin{pmatrix*}[r] 4 \\ 1 \\ -1 \\ 2 \end{pmatrix*}.
ShowHide solution

Multiply each component of bu‾\overline{\vphantom{b}u} by 3 and each component of bv‾\overline{\vphantom{b}v} by −2-2, then add the matching components:

3bu‾−2bv‾=3(1−203)+(−2)(41−12)=(3−609)+(−8−22−4)=(−5−825). 3\overline{\vphantom{b}u} - 2\overline{\vphantom{b}v} = 3\begin{pmatrix*}[r] 1 \\ -2 \\ 0 \\ 3 \end{pmatrix*} + (-2)\begin{pmatrix*}[r] 4 \\ 1 \\ -1 \\ 2 \end{pmatrix*} = \begin{pmatrix*}[r] 3 \\ -6 \\ 0 \\ 9 \end{pmatrix*} + \begin{pmatrix*}[r] -8 \\ -2 \\ 2 \\ -4 \end{pmatrix*} = \begin{pmatrix*}[r] -5 \\ -8 \\ 2 \\ 5 \end{pmatrix*}.

Example 4

For

bu‾=(1−203),bv‾=(41−12),bw‾=(−3051), \overline{\vphantom{b}u} = \begin{pmatrix*}[r] 1 \\ -2 \\ 0 \\ 3 \end{pmatrix*}, \quad \overline{\vphantom{b}v} = \begin{pmatrix*}[r] 4 \\ 1 \\ -1 \\ 2 \end{pmatrix*}, \quad \overline{\vphantom{b}w} = \begin{pmatrix*}[r] -3 \\ 0 \\ 5 \\ 1 \end{pmatrix*},

compute 3bu‾−2bv‾3\overline{\vphantom{b}u} - 2\overline{\vphantom{b}v} and −bu‾+2bv‾+bw‾-\overline{\vphantom{b}u} + 2\overline{\vphantom{b}v} + \overline{\vphantom{b}w} in R.

ShowHide solution

Store the three vectors, then type each combination with the arithmetic symbols. Used R.

u = c(1, -2, 0, 3)
v = c(4, 1, -1, 2)
w = c(-3, 0, 5, 1)
3 * u - 2 * v
[1] -5 -8  2  5
-u + 2 * v + w
[1] 4 4 3 2

Written as columns, the two results are

3bu‾−2bv‾=(−5−825),−bu‾+2bv‾+bw‾=(4432). 3\overline{\vphantom{b}u} - 2\overline{\vphantom{b}v} = \begin{pmatrix*}[r] -5 \\ -8 \\ 2 \\ 5 \end{pmatrix*}, \qquad -\overline{\vphantom{b}u} + 2\overline{\vphantom{b}v} + \overline{\vphantom{b}w} = \begin{pmatrix*}[r] 4 \\ 4 \\ 3 \\ 2 \end{pmatrix*}.

The first result matches the hand computation of Example 3, because R pairs the components by position.

Example 5

Each B-1B sortie carries the load bb‾=(816)\overline{\vphantom{b}b} = \left(\begin{smallmatrix} 8\\16 \end{smallmatrix}\right) and each B-52H sortie carries bh‾=(128)\overline{\vphantom{b}h} = \left(\begin{smallmatrix} 12\\8 \end{smallmatrix}\right), JASSM first and GBU-31 second. Compute the total load 3bb‾+2bh‾3\overline{\vphantom{b}b} + 2\overline{\vphantom{b}h} of three B-1B sorties and two B-52H sorties by hand and in R.

ShowHide solution

Multiply each component of bb‾\overline{\vphantom{b}b} by 3 and each component of bh‾\overline{\vphantom{b}h} by 2, then add the matching components:

3bb‾+2bh‾=3(816)+2(128)=(2448)+(2416)=(4864). 3\overline{\vphantom{b}b} + 2\overline{\vphantom{b}h} = 3\begin{pmatrix*}[r] 8 \\ 16 \end{pmatrix*} + 2\begin{pmatrix*}[r] 12 \\ 8 \end{pmatrix*} = \begin{pmatrix*}[r] 24 \\ 48 \end{pmatrix*} + \begin{pmatrix*}[r] 24 \\ 16 \end{pmatrix*} = \begin{pmatrix*}[r] 48 \\ 64 \end{pmatrix*}.

In R, the line 3 * b + 2 * h does the same two steps. Used R.

b = c(8, 16)
h = c(12, 8)
3 * b + 2 * h
[1] 48 64

The five sorties carry 48 JASSM and 64 GBU-31.

Next: 3. Systems and Vector EquationsLesson map

3. Systems and Vector Equations

Objective. Rewrite a system of equations as an equivalent vector equation (and vice-versa).

Definition 2 (Vector equation).

A vector equation is an equality between linear combinations of vectors.

The equation xbu‾+ybv‾=7x\overline{\vphantom{b}u} + y\overline{\vphantom{b}v} = 7 is not a vector equation, because its right side 7 is a scalar. The definition requires a linear combination of vectors on each side.

Each equation of a system of linear equations is one component of the equivalent vector equation.

  1. Write every equation with the unknowns in the same order on the left and the constant on the right. An unknown missing from an equation has coefficient 0.
  2. Write the coefficients of each unknown top to bottom as one vector multiplied by that unknown.
  3. Write the right-hand sides top to bottom as one vector.
  4. Set the sum of the scaled vectors equal to that vector.

To rewrite a vector equation as a system, take the components one row at a time.

  1. For the first row, multiply the first component of each scaled vector by its unknown, and add the products on the left side of the first equation.
  2. Put the first component of the vector on the other side on the right side of the first equation.
  3. Repeat for each later row, one equation per row.

Example 6

Each B-1B sortie carries 8 JASSM and 16 GBU-31 bombs. Each B-52H sortie carries 12 JASSM and 8 GBU-31. A strike takes 28 JASSM and 40 GBU-31. With xx B-1B sorties and yy B-52H sorties, write the tasking as a system of equations, then as a vector equation.

ShowHide solution

Count each munition over both bomber types, one equation per munition:

8x+12y=28,(JASSM)16x+8y=40.(GBU-31) \begin{aligned} 8x + 12y &= 28, &&\text{(JASSM)}\\ 16x + 8y &= 40. &&\text{(GBU-31)} \end{aligned}

Each sortie’s load is one vector, with the JASSM count first. The first equation becomes the first component and the second equation the second component:

x(816)+y(128)=(2840). x\begin{pmatrix*}[r] 8 \\ 16 \end{pmatrix*} + y\begin{pmatrix*}[r] 12 \\ 8 \end{pmatrix*} = \begin{pmatrix*}[r] 28 \\ 40 \end{pmatrix*}.

By the definition of a vector equation, this is one: each side is a linear combination of vectors, the right side with the single scalar 1. The method of section 4 gives the solution x=2x = 2 and y=1y = 1. Substituting these scalars shows that two B-1B sorties and one B-52H sortie fill the tasking:

2(816)+1(128)=(1632)+(128)=(2840). 2\begin{pmatrix*}[r] 8 \\ 16 \end{pmatrix*} + 1\begin{pmatrix*}[r] 12 \\ 8 \end{pmatrix*} = \begin{pmatrix*}[r] 16 \\ 32 \end{pmatrix*} + \begin{pmatrix*}[r] 12 \\ 8 \end{pmatrix*} = \begin{pmatrix*}[r] 28 \\ 40 \end{pmatrix*}.

Example 7

Rewrite the system as a vector equation:

−x+4y+z=3,6x−5y+7z=0,x+z=8. \begin{aligned} -x + 4y + z &= 3,\\ 6x - 5y + 7z &= 0,\\ x + z &= 8. \end{aligned}
ShowHide solution

Write the coefficients of each unknown, top to bottom, as the vector that unknown multiplies. The third equation has no yy, and the third component of the vector multiplied by yy is 0:

x(−161)+y(4−50)+z(171)=(308). x\begin{pmatrix*}[r] -1 \\ 6 \\ 1 \end{pmatrix*} + y\begin{pmatrix*}[r] 4 \\ -5 \\ 0 \end{pmatrix*} + z\begin{pmatrix*}[r] 1 \\ 7 \\ 1 \end{pmatrix*} = \begin{pmatrix*}[r] 3 \\ 0 \\ 8 \end{pmatrix*}.

Example 8

Rewrite the vector equation as a system of equations:

x(130)+y(4−81)+z(50−1)=(2−613). x\begin{pmatrix*}[r] 1 \\ 3 \\ 0 \end{pmatrix*} + y\begin{pmatrix*}[r] 4 \\ -8 \\ 1 \end{pmatrix*} + z\begin{pmatrix*}[r] 5 \\ 0 \\ -1 \end{pmatrix*} = \begin{pmatrix*}[r] 2 \\ -6 \\ 13 \end{pmatrix*}.
ShowHide solution

Take the components one row at a time, one equation per row. An unknown whose component is 0 is left out of that row’s equation:

x+4y+5z=2,3x−8y=−6,y−z=13. \begin{aligned} x + 4y + 5z &= 2,\\ 3x - 8y &= -6,\\ y - z &= 13. \end{aligned}

The sum of the scaled vectors may sit on either side: the equations bw‾=xbu‾+ybv‾\overline{\vphantom{b}w} = x\overline{\vphantom{b}u} + y\overline{\vphantom{b}v} and xbu‾+ybv‾=bw‾x\overline{\vphantom{b}u} + y\overline{\vphantom{b}v} = \overline{\vphantom{b}w} are the same equation.

Next: 4. Solving a Vector Equation by HandLesson map

4. Solving a Vector Equation by Hand

Objective. Given a vector equation, solve for the scalars of the linear combination by hand.

Two vectors of the same dimension are equal when their matching components are equal (MMAC p. 284). A vector equation is therefore true exactly when the equation for each of its components is true.

The pair x=ax = a and y=by = b is a solution of the vector equation bw‾=xbu‾+ybv‾\overline{\vphantom{b}w} = x\overline{\vphantom{b}u} + y\overline{\vphantom{b}v} when bw‾\overline{\vphantom{b}w} is equal to abu‾+bbv‾a\overline{\vphantom{b}u} + b\overline{\vphantom{b}v}.

  1. Write one equation per component.
  2. Solve the two equations. To substitute, solve one equation for one unknown and put the result into the other. To eliminate, multiply one or both equations by numbers so that one unknown has the same coefficient up to sign, then add or subtract the equations so that the unknown drops out.
  3. Check the scalars by computing the linear combination with them.

Example 9

Solve for aa and bb:

(51)=a(20)+b(−11). \begin{pmatrix*}[r] 5 \\ 1 \end{pmatrix*} = a\begin{pmatrix*}[r] 2 \\ 0 \end{pmatrix*} + b\begin{pmatrix*}[r] -1 \\ 1 \end{pmatrix*}.
ShowHide solution

Write one equation per component:

5=2a−b,1=b. 5 = 2a - b, \qquad 1 = b.

Substitute b=1b = 1 from the second equation into the first, and solve for aa:

5=2a−1,6=2a,a=3. 5 = 2a - 1, \qquad 6 = 2a, \qquad a = 3.

As a check, the linear combination with a=3a = 3 and b=1b = 1 returns the right side:

3(20)+1(−11)=(60)+(−11)=(51). 3\begin{pmatrix*}[r] 2 \\ 0 \end{pmatrix*} + 1\begin{pmatrix*}[r] -1 \\ 1 \end{pmatrix*} = \begin{pmatrix*}[r] 6 \\ 0 \end{pmatrix*} + \begin{pmatrix*}[r] -1 \\ 1 \end{pmatrix*} = \begin{pmatrix*}[r] 5 \\ 1 \end{pmatrix*}.

Example 10

MMAC 3.2 Example 3: solve for xx and yy:

(710)=x(2−1)+y(14). \begin{pmatrix*}[r] 7 \\ 10 \end{pmatrix*} = x\begin{pmatrix*}[r] 2 \\ -1 \end{pmatrix*} + y\begin{pmatrix*}[r] 1 \\ 4 \end{pmatrix*}.
ShowHide solution

Write one equation per component:

2x+y=7,−x+4y=10. 2x + y = 7, \qquad -x + 4y = 10.

Solve the first equation for yy, which gives y=7−2xy = 7 - 2x, and substitute it into the second:

−x+4(7−2x)=−9x+28=10,−9x=−18,x=2. -x + 4(7 - 2x) = -9x + 28 = 10, \qquad -9x = -18, \qquad x = 2.

Substitute x=2x = 2 into y=7−2xy = 7 - 2x:

y=7−2(2)=3. y = 7 - 2(2) = 3.

As a check, the linear combination with x=2x = 2 and y=3y = 3 returns the right side:

2(2−1)+3(14)=(4−2)+(312)=(710). 2\begin{pmatrix*}[r] 2 \\ -1 \end{pmatrix*} + 3\begin{pmatrix*}[r] 1 \\ 4 \end{pmatrix*} = \begin{pmatrix*}[r] 4 \\ -2 \end{pmatrix*} + \begin{pmatrix*}[r] 3 \\ 12 \end{pmatrix*} = \begin{pmatrix*}[r] 7 \\ 10 \end{pmatrix*}.

Example 11

Solve for aa and bb:

a(0−3)+b(53)=(10−5). a\begin{pmatrix*}[r] 0 \\ -3 \end{pmatrix*} + b\begin{pmatrix*}[r] 5 \\ 3 \end{pmatrix*} = \begin{pmatrix*}[r] 10 \\ -5 \end{pmatrix*}.
ShowHide solution

Write one equation per component:

5b=10,−3a+3b=−5. 5b = 10, \qquad -3a + 3b = -5.

The first equation has only bb, and gives b=2b = 2. Substitute b=2b = 2 into the second and solve for aa:

−3a+3(2)=−5,−3a=−11,a=113≈3.667. -3a + 3(2) = -5, \qquad -3a = -11, \qquad a = \tfrac{11}{3} \approx 3.667.

To check the scalars in R, compute the linear combination with the exact fraction and with the rounded value:

u = c(0, -3)
v = c(5, 3)
(11/3) * u + 2 * v
[1] 10 -5
3.667 * u + 2 * v
[1] 10.000 -5.001

The exact fraction returns the right side, and the rounded scalar misses the second component by 0.001.

Example 12

Solve for xx and yy:

x(32)+y(4−5)=(103). x\begin{pmatrix*}[r] 3 \\ 2 \end{pmatrix*} + y\begin{pmatrix*}[r] 4 \\ -5 \end{pmatrix*} = \begin{pmatrix*}[r] 10 \\ 3 \end{pmatrix*}.
ShowHide solution

Write one equation per component:

3x+4y=10,2x−5y=3. 3x + 4y = 10, \qquad 2x - 5y = 3.

Elimination is shorter than substitution here, because no coefficient is 1, −1-1, or 0. Add 5 times the first equation to 4 times the second to eliminate yy. The multipliers 5 and 4 make the yy terms 20y20y and −20y-20y, which cancel:

5(3x+4y)+4(2x−5y)=5(10)+4(3),15x+20y+8x−20y=50+12,23x=62,x=6223≈2.696. \begin{aligned} 5(3x + 4y) + 4(2x - 5y) &= 5(10) + 4(3),\\ 15x + 20y + 8x - 20y &= 50 + 12,\\ 23x &= 62,\\ x &= \tfrac{62}{23} \approx 2.696. \end{aligned}

Subtract 3 times the second equation from 2 times the first to eliminate xx. The multipliers 2 and 3 make both xx terms 6x6x:

2(3x+4y)−3(2x−5y)=2(10)−3(3),6x+8y−6x+15y=20−9,23y=11,y=1123≈0.478. \begin{aligned} 2(3x + 4y) - 3(2x - 5y) &= 2(10) - 3(3),\\ 6x + 8y - 6x + 15y &= 20 - 9,\\ 23y &= 11,\\ y &= \tfrac{11}{23} \approx 0.478. \end{aligned}

As a check, the linear combination with the exact fractions returns the right side:

6223(32)+1123(4−5)=(186/23124/23)+(44/23−55/23)=(230/2369/23)=(103). \tfrac{62}{23}\begin{pmatrix*}[r] 3 \\ 2 \end{pmatrix*} + \tfrac{11}{23}\begin{pmatrix*}[r] 4 \\ -5 \end{pmatrix*} = \begin{pmatrix*}[r] 186/23 \\ 124/23 \end{pmatrix*} + \begin{pmatrix*}[r] 44/23 \\ -55/23 \end{pmatrix*} = \begin{pmatrix*}[r] 230/23 \\ 69/23 \end{pmatrix*} = \begin{pmatrix*}[r] 10 \\ 3 \end{pmatrix*}.

Next: 5. Size of a MatrixLesson map

5. Size of a Matrix

Objective. Determine the size (rows and columns) of a given matrix.

Definition 3 (Matrix).

An m×nm \times n matrix is a rectangular array of real numbers arranged in mm rows and nn columns.

The arrangement

12345 \begin{matrix} 1 & 2 \\ 3 & 4 & 5 \end{matrix}

is not a matrix, because its rows have different lengths, and a matrix is a rectangular array.

Definition 4 (Size of a matrix).

The size of a matrix is written rows first, then columns, as in m×nm \times n.

Each column of an m×nm \times n matrix is a vector of dimension mm, and a vector of dimension mm is itself an m×1m \times 1 matrix.

A square matrix has the same number of rows and columns.

Example 13

Determine the size of each matrix and write out its columns:

A=(1460),B=(463322),C=(10−2354),bv‾=(5−12). A = \begin{pmatrix*}[r] 1 & 4 \\ 6 & 0 \end{pmatrix*}, \qquad B = \begin{pmatrix*}[r] 4 & 6 \\ 3 & 3 \\ 2 & 2 \end{pmatrix*}, \qquad C = \begin{pmatrix*}[r] 1 & 0 & -2 \\ 3 & 5 & 4 \end{pmatrix*}, \qquad \overline{\vphantom{b}v} = \begin{pmatrix*}[r] 5 \\ -1 \\ 2 \end{pmatrix*}.
ShowHide solution
  • By the definition of size, rows come first. Matrix AA has 2 rows and 2 columns. It is 2×22 \times 2, with columns (16)\left(\begin{smallmatrix} 1\\6 \end{smallmatrix}\right) and (40)\left(\begin{smallmatrix} 4\\0 \end{smallmatrix}\right).
  • Matrix BB is 3×23 \times 2, with columns (432)\left(\begin{smallmatrix} 4\\3\\2 \end{smallmatrix}\right) and (632)\left(\begin{smallmatrix} 6\\3\\2 \end{smallmatrix}\right).
  • Matrix CC is 2×32 \times 3, with columns (13)\left(\begin{smallmatrix} 1\\3 \end{smallmatrix}\right), (05)\left(\begin{smallmatrix} 0\\5 \end{smallmatrix}\right), and (−24)\left(\begin{smallmatrix} -2\\4 \end{smallmatrix}\right).
  • The vector bv‾\overline{\vphantom{b}v} is 3×13 \times 1.

Matrices BB and CC each contain six numbers but have different sizes, because BB is 3×23 \times 2 and CC is 2×32 \times 3.

Example 14

A squadron log records the sorties flown by each of three squadrons on each of the five days of a week, one row per day and one column per squadron. Give the size of the log as a matrix, and the dimension of each of its columns.

ShowHide solution

The log is a 5×35 \times 3 matrix, because it has one row per day and one column per squadron. Each column lists one squadron’s sorties over the five days, a vector of dimension 5.

Next: 6. Matrix-Vector ProductLesson map

6. Matrix-Vector Product

Objective. Compute the product of a vector and a matrix, or determine the product is undefined.

Definition 5 (Matrix-vector product).

For a matrix AA with columns bu‾1,bu‾2,…,bu‾n\overline{\vphantom{b}u}_1, \overline{\vphantom{b}u}_2, \dots, \overline{\vphantom{b}u}_n and a vector bx‾\overline{\vphantom{b}x} with components x1,x2,…,xnx_1, x_2, \dots, x_n, the matrix-vector product is

Abx‾=x1bu‾1+x2bu‾2+⋯+xnbu‾n. A\overline{\vphantom{b}x} = x_1\overline{\vphantom{b}u}_1 + x_2\overline{\vphantom{b}u}_2 + \dots + x_n\overline{\vphantom{b}u}_n.

The product (1375)(123)\left(\begin{smallmatrix} 1 & 3\\7 & 5 \end{smallmatrix}\right)\left(\begin{smallmatrix} 1\\2\\3 \end{smallmatrix}\right) is undefined, because the definition pairs each column of the matrix with one component of the vector, and the matrix has two columns for three components.

The product Abx‾A\overline{\vphantom{b}x}, with the matrix written first, has one component per row of AA.

  1. Count the columns of AA and the components of bx‾\overline{\vphantom{b}x}. Unequal counts mean the product is undefined.
  2. Scale each column of AA by the matching component of bx‾\overline{\vphantom{b}x}.
  3. Add the scaled columns.

Example 15

Compute the product:

(1375)(23). \begin{pmatrix*}[r] 1 & 3 \\ 7 & 5 \end{pmatrix*}\begin{pmatrix*}[r] 2 \\ 3 \end{pmatrix*}.
ShowHide solution

The product is defined, because the matrix has two columns and the vector has two components. Scale each column by the matching component of the vector and add, by the definition of the matrix-vector product:

(1375)(23)=2(17)+3(35)=(214)+(915)=(1129). \begin{pmatrix*}[r] 1 & 3 \\ 7 & 5 \end{pmatrix*}\begin{pmatrix*}[r] 2 \\ 3 \end{pmatrix*} = 2\begin{pmatrix*}[r] 1 \\ 7 \end{pmatrix*} + 3\begin{pmatrix*}[r] 3 \\ 5 \end{pmatrix*} = \begin{pmatrix*}[r] 2 \\ 14 \end{pmatrix*} + \begin{pmatrix*}[r] 9 \\ 15 \end{pmatrix*} = \begin{pmatrix*}[r] 11 \\ 29 \end{pmatrix*}.

In the figure, the blue arrow is the first column scaled by 2. The green dashed arrow is the second column scaled by 3, drawn tip to tail. The orange arrow from the origin to (11,29)(11, 29) is the product.

Figure

Example 16

Compute the product:

(410−123605)(−213). \begin{pmatrix*}[r] 4 & 1 & 0 \\ -1 & 2 & 3 \\ 6 & 0 & 5 \end{pmatrix*}\begin{pmatrix*}[r] -2 \\ 1 \\ 3 \end{pmatrix*}.
ShowHide solution

The product is defined, because the matrix has three columns and the vector has three components. Scale each column and add, as in Example 15:

−2(4−16)+1(120)+3(035)=(−82−12)+(120)+(0915)=(−7133). -2\begin{pmatrix*}[r] 4 \\ -1 \\ 6 \end{pmatrix*} + 1\begin{pmatrix*}[r] 1 \\ 2 \\ 0 \end{pmatrix*} + 3\begin{pmatrix*}[r] 0 \\ 3 \\ 5 \end{pmatrix*} = \begin{pmatrix*}[r] -8 \\ 2 \\ -12 \end{pmatrix*} + \begin{pmatrix*}[r] 1 \\ 2 \\ 0 \end{pmatrix*} + \begin{pmatrix*}[r] 0 \\ 9 \\ 15 \end{pmatrix*} = \begin{pmatrix*}[r] -7 \\ 13 \\ 3 \end{pmatrix*}.

As a check, store the columns as u1, u2, and u3 and compute the same linear combination in R. Used R.

u1 = c(4, -1, 6)
u2 = c(1, 2, 0)
u3 = c(0, 3, 5)
-2 * u1 + 1 * u2 + 3 * u3
[1] -7 13  3

R returns the same vector, (−7133)\left(\begin{smallmatrix} -7\\13\\3 \end{smallmatrix}\right).

Example 17

Compute the product:

(164−534)(12). \begin{pmatrix*}[r] 1 & 6 \\ 4 & -5 \\ 3 & 4 \end{pmatrix*}\begin{pmatrix*}[r] 1 \\ 2 \end{pmatrix*}.
ShowHide solution

The product is defined, because the 3×23 \times 2 matrix has two columns and the vector has two components. Scale each column and add; the product has 3 components, one per row:

1(143)+2(6−54)=(143)+(12−108)=(13−611). 1\begin{pmatrix*}[r] 1 \\ 4 \\ 3 \end{pmatrix*} + 2\begin{pmatrix*}[r] 6 \\ -5 \\ 4 \end{pmatrix*} = \begin{pmatrix*}[r] 1 \\ 4 \\ 3 \end{pmatrix*} + \begin{pmatrix*}[r] 12 \\ -10 \\ 8 \end{pmatrix*} = \begin{pmatrix*}[r] 13 \\ -6 \\ 11 \end{pmatrix*}.

Example 18

For

B=(463322),C=(10−2354), B = \begin{pmatrix*}[r] 4 & 6 \\ 3 & 3 \\ 2 & 2 \end{pmatrix*}, \qquad C = \begin{pmatrix*}[r] 1 & 0 & -2 \\ 3 & 5 & 4 \end{pmatrix*},

determine whether each product is defined, and compute the one that is:

B(123),C(123). B\left(\begin{smallmatrix} 1\\2\\3 \end{smallmatrix}\right), \qquad C\left(\begin{smallmatrix} 1\\2\\3 \end{smallmatrix}\right).
ShowHide solution

The product B(123)B\left(\begin{smallmatrix} 1\\2\\3 \end{smallmatrix}\right) is undefined, because BB has 2 columns and the vector has 3 components. The product C(123)C\left(\begin{smallmatrix} 1\\2\\3 \end{smallmatrix}\right) is defined, because CC has 3 columns. Scale each column of CC and add:

1(13)+2(05)+3(−24)=(13)+(010)+(−612)=(−525). 1\begin{pmatrix*}[r] 1 \\ 3 \end{pmatrix*} + 2\begin{pmatrix*}[r] 0 \\ 5 \end{pmatrix*} + 3\begin{pmatrix*}[r] -2 \\ 4 \end{pmatrix*} = \begin{pmatrix*}[r] 1 \\ 3 \end{pmatrix*} + \begin{pmatrix*}[r] 0 \\ 10 \end{pmatrix*} + \begin{pmatrix*}[r] -6 \\ 12 \end{pmatrix*} = \begin{pmatrix*}[r] -5 \\ 25 \end{pmatrix*}.

A matrix equation Abx‾=bw‾A\overline{\vphantom{b}x} = \overline{\vphantom{b}w} is a vector equation with its vectors as the columns of AA and its scalars as the components of bx‾\overline{\vphantom{b}x}.

Example 19

Rewrite as a vector equation:

(2−101)(ab)=(51). \begin{pmatrix*}[r] 2 & -1 \\ 0 & 1 \end{pmatrix*}\begin{pmatrix*}[r] a \\ b \end{pmatrix*} = \begin{pmatrix*}[r] 5 \\ 1 \end{pmatrix*}.
ShowHide solution

The columns of the matrix become the vectors, and the unknowns become the scalars:

a(20)+b(−11)=(51). a\begin{pmatrix*}[r] 2 \\ 0 \end{pmatrix*} + b\begin{pmatrix*}[r] -1 \\ 1 \end{pmatrix*} = \begin{pmatrix*}[r] 5 \\ 1 \end{pmatrix*}.

Example 20

Write the bomber vector equation of Example 6 as a matrix equation, and give the size of its matrix:

x(816)+y(128)=(2840). x\begin{pmatrix*}[r] 8 \\ 16 \end{pmatrix*} + y\begin{pmatrix*}[r] 12 \\ 8 \end{pmatrix*} = \begin{pmatrix*}[r] 28 \\ 40 \end{pmatrix*}.
ShowHide solution

The columns of the matrix are the two sortie loads, in the order of their scalars xx and yy:

(812168)(xy)=(2840). \begin{pmatrix*}[r] 8 & 12 \\ 16 & 8 \end{pmatrix*}\begin{pmatrix*}[r] x \\ y \end{pmatrix*} = \begin{pmatrix*}[r] 28 \\ 40 \end{pmatrix*}.

The matrix is 2×22 \times 2, because it has one row per munition and one column per bomber type. With the loads written as rows, the product (816128)(xy)\left(\begin{smallmatrix} 8 & 16\\12 & 8 \end{smallmatrix}\right)\left(\begin{smallmatrix} x\\y \end{smallmatrix}\right) is x(812)+y(168)x\left(\begin{smallmatrix} 8\\12 \end{smallmatrix}\right) + y\left(\begin{smallmatrix} 16\\8 \end{smallmatrix}\right), a different linear combination from the tasking’s x(816)+y(128)x\left(\begin{smallmatrix} 8\\16 \end{smallmatrix}\right) + y\left(\begin{smallmatrix} 12\\8 \end{smallmatrix}\right).

Lesson map