Linear Combinations
A linear combination of vectors v₁, v₂, …, vₚ is any sum c₁v₁ + c₂v₂ + ⋯ + cₚvₚ, with scalar weights c₁, …, cₚ. To find whether a vector b is a linear combination of given vectors, solve the vector equation x₁v₁ + ⋯ + xₚvₚ = b by row reducing the augmented matrix [v₁ ⋯ vₚ | b].
Before this lesson: Vectors in 3D and Gaussian Elimination
What a linear combination means
A vector in ℝⁿ is a list of n numbers, written as a column. You can do two things with vectors: multiply one by a number (a scalar), which stretches or flips it, and add two of them entry by entry. A linear combination uses only these two moves.
Think of v₁ and v₂ as two directions you are allowed to walk. The weights say how far to go in each direction. The question “is b a linear combination of v₁ and v₂?” asks whether you can reach the point b using only those two directions.
The vector equation and its augmented matrix
The weights x₁, …, xₚ that make the combination equal b are the solutions of a vector equation:
x_1\mathbf{v}_1 + x_2\mathbf{v}_2 + \cdots + x_p\mathbf{v}_p = \mathbf{b}Each entry of the vectors gives one ordinary equation, so the vector equation has exactly the same solutions as the linear system whose augmented matrix is
\left[\begin{array}{cccc|c} \mathbf{v}_1 & \mathbf{v}_2 & \cdots & \mathbf{v}_p & \mathbf{b} \end{array}\right]- Write the vectors v₁, …, vₚ as the columns of a matrix and put b in the last column.
- Row reduce with Gaussian elimination.
- If a row reads [0 ⋯ 0 | c] with c ≠ 0, the system is inconsistent and b is not a linear combination.
- Otherwise b is a linear combination. Read the weights; a free variable means there are infinitely many sets of weights.
- Check by computing the combination.
Linear combination examples
Example 1: Compute a linear combination
Find 3u − 2v for u = (1, −2, 4) and v = (2, 0, −1).
3\mathbf{u} = \begin{bmatrix} 3 \\ -6 \\ 12 \end{bmatrix}Multiply each entry of u by 3.
-2\mathbf{v} = \begin{bmatrix} -4 \\ 0 \\ 2 \end{bmatrix}Multiply each entry of v by −2.
3\mathbf{u} - 2\mathbf{v} = \begin{bmatrix} 3 + (-4) \\ -6 + 0 \\ 12 + 2 \end{bmatrix}Add entry by entry (see adding and subtracting vectors).
3\mathbf{u} - 2\mathbf{v} = \begin{bmatrix} -1 \\ -6 \\ 14 \end{bmatrix}Simplify each entry.
Answer: 3u − 2v = (−1, −6, 14).
Example 2: Find the weights in ℝ²
Write b = (3, 4) as a linear combination of v₁ = (2, 1) and v₂ = (−1, 2).
x_1\begin{bmatrix} 2 \\ 1 \end{bmatrix} + x_2\begin{bmatrix} -1 \\ 2 \end{bmatrix} = \begin{bmatrix} 3 \\ 4 \end{bmatrix}The vector equation.
\left[\begin{array}{rr|r} 2 & -1 & 3 \\ 1 & 2 & 4 \end{array}\right]Augmented matrix [v₁ v₂ | b].
\left[\begin{array}{rr|r} 1 & 2 & 4 \\ 2 & -1 & 3 \end{array}\right]R₁ ↔ R₂, so the first pivot is 1.
\left[\begin{array}{rr|r} 1 & 2 & 4 \\ 0 & -5 & -5 \end{array}\right]R₂ − 2R₁ → R₂: −1 − 4 = −5 and 3 − 8 = −5.
\left[\begin{array}{rr|r} 1 & 2 & 4 \\ 0 & 1 & 1 \end{array}\right]−(1/5)R₂ → R₂.
\left[\begin{array}{rr|r} 1 & 0 & 2 \\ 0 & 1 & 1 \end{array}\right]R₁ − 2R₂ → R₁: 4 − 2 = 2.
2\begin{bmatrix} 2 \\ 1 \end{bmatrix} + 1\begin{bmatrix} -1 \\ 2 \end{bmatrix} = \begin{bmatrix} 3 \\ 4 \end{bmatrix}Check: 4 − 1 = 3 and 2 + 2 = 4.
Answer: b = 2v₁ + v₂, which is the path in the graph above.
Example 3: Three vectors in ℝ³
Is b = (5, −2, 1) a linear combination of a₁ = (1, −1, 2), a₂ = (2, 1, 0) and a₃ = (0, 3, 1)? If so, find the weights.
\left[\begin{array}{rrr|r} 1 & 2 & 0 & 5 \\ -1 & 1 & 3 & -2 \\ 2 & 0 & 1 & 1 \end{array}\right]Augmented matrix [a₁ a₂ a₃ | b].
\left[\begin{array}{rrr|r} 1 & 2 & 0 & 5 \\ 0 & 3 & 3 & 3 \\ 2 & 0 & 1 & 1 \end{array}\right]R₂ + R₁ → R₂.
\left[\begin{array}{rrr|r} 1 & 2 & 0 & 5 \\ 0 & 3 & 3 & 3 \\ 0 & -4 & 1 & -9 \end{array}\right]R₃ − 2R₁ → R₃: 0 − 4 = −4 and 1 − 10 = −9.
\left[\begin{array}{rrr|r} 1 & 2 & 0 & 5 \\ 0 & 1 & 1 & 1 \\ 0 & -4 & 1 & -9 \end{array}\right](1/3)R₂ → R₂.
\left[\begin{array}{rrr|r} 1 & 2 & 0 & 5 \\ 0 & 1 & 1 & 1 \\ 0 & 0 & 5 & -5 \end{array}\right]R₃ + 4R₂ → R₃: 1 + 4 = 5 and −9 + 4 = −5.
\left[\begin{array}{rrr|r} 1 & 2 & 0 & 5 \\ 0 & 1 & 1 & 1 \\ 0 & 0 & 1 & -1 \end{array}\right](1/5)R₃ → R₃. Echelon form with no bad row, so b is a combination.
x_3 = -1
Row 3.
x_2 = 1 - x_3 = 1 - (-1) = 2
Row 2: x₂ + x₃ = 1; back substitute.
x_1 = 5 - 2x_2 = 5 - 4 = 1
Row 1: x₁ + 2x₂ = 5.
Answer: yes, b = a₁ + 2a₂ − a₃. Check: (1 + 4 + 0, −1 + 2 − 3, 2 + 0 − 1) = (5, −2, 1).
Example 4: A vector that is not a linear combination
Is b = (4, 1, 6) a linear combination of a₁ = (1, 0, 2) and a₂ = (2, 1, 1)?
\left[\begin{array}{rr|r} 1 & 2 & 4 \\ 0 & 1 & 1 \\ 2 & 1 & 6 \end{array}\right]Augmented matrix [a₁ a₂ | b].
\left[\begin{array}{rr|r} 1 & 2 & 4 \\ 0 & 1 & 1 \\ 0 & -3 & -2 \end{array}\right]R₃ − 2R₁ → R₃: 1 − 4 = −3 and 6 − 8 = −2.
\left[\begin{array}{rr|r} 1 & 2 & 4 \\ 0 & 1 & 1 \\ 0 & 0 & 1 \end{array}\right]R₃ + 3R₂ → R₃: −2 + 3 = 1.
0x_1 + 0x_2 = 1
Row 3 says 0 = 1, which is impossible.
Answer: no. The system is inconsistent, so no weights work. Rows 1 and 2 force x₂ = 1 and x₁ = 2, but then the third entry is 2(2) + 1(1) = 5, not 6.
Example 5: Mixing two cereals
One serving of cereal A has 4 g protein, 2 g fiber and 1 g fat. One serving of cereal B has 3 g protein, 2 g fiber and 1 g fat. Can a breakfast mix give exactly 14 g protein, 8 g fiber and 4 g fat? How many servings of each?
x_1\begin{bmatrix} 4 \\ 2 \\ 1 \end{bmatrix} + x_2\begin{bmatrix} 3 \\ 2 \\ 1 \end{bmatrix} = \begin{bmatrix} 14 \\ 8 \\ 4 \end{bmatrix}x₁ servings of A and x₂ servings of B; entries are protein, fiber, fat.
\left[\begin{array}{rr|r} 4 & 3 & 14 \\ 2 & 2 & 8 \\ 1 & 1 & 4 \end{array}\right]Augmented matrix.
\left[\begin{array}{rr|r} 1 & 1 & 4 \\ 2 & 2 & 8 \\ 4 & 3 & 14 \end{array}\right]R₁ ↔ R₃.
\left[\begin{array}{rr|r} 1 & 1 & 4 \\ 0 & 0 & 0 \\ 4 & 3 & 14 \end{array}\right]R₂ − 2R₁ → R₂.
\left[\begin{array}{rr|r} 1 & 1 & 4 \\ 0 & 0 & 0 \\ 0 & -1 & -2 \end{array}\right]R₃ − 4R₁ → R₃: 3 − 4 = −1 and 14 − 16 = −2.
\left[\begin{array}{rr|r} 1 & 1 & 4 \\ 0 & -1 & -2 \\ 0 & 0 & 0 \end{array}\right]R₂ ↔ R₃.
\left[\begin{array}{rr|r} 1 & 1 & 4 \\ 0 & 1 & 2 \\ 0 & 0 & 0 \end{array}\right]−R₂ → R₂.
\left[\begin{array}{rr|r} 1 & 0 & 2 \\ 0 & 1 & 2 \\ 0 & 0 & 0 \end{array}\right]R₁ − R₂ → R₁.
Answer: yes, 2 servings of each: 2(4, 2, 1) + 2(3, 2, 1) = (14, 8, 4).
Common mistakes
| Mistake | Example of the error | Fix |
|---|---|---|
| Putting the vectors in rows | Writing [2 1 | 3; −1 2 | 4] for Example 2 | Each vector is a column: [2 −1 | 3; 1 2 | 4]. |
| Multiplying only the first entry | 3(1, −2, 4) = (3, −2, 4) | A scalar multiplies every entry: (3, −6, 12). |
| Stopping before checking for a bad row | Reading x₁ = 2, x₂ = 1 from the top rows in Example 4 | Reduce every row; [0 0 | 1] means no solution. |
| Thinking a zero row means no solution | Answering “no” in Example 5 because of the row [0 0 | 0] | A zero row is 0 = 0, which is always true; only [0 ⋯ 0 | c] with c ≠ 0 is a problem. |
| Expecting one set of weights | Giving only (5, 3, 0) in Practice 9 | A free variable gives infinitely many sets of weights. |
Related ideas
Span
The set of all linear combinations of v₁, …, vₚ is called their span. Asking whether b is a linear combination is the same as asking whether b is in the span, which is the topic of the next lesson, Span of Vectors.
The matrix equation Ax = b
If A is the matrix with columns v₁, …, vₚ, the combination x₁v₁ + ⋯ + xₚvₚ is written Ax, which is how matrix multiplication of a matrix by a vector works. So the vector equation, the matrix equation Ax = b and the augmented matrix all describe the same problem. The lesson Matrix Equation Ax = b builds on this.
Practice problems
- Find 2u + 3v for u = (1, −1) and v = (0, 2).
- Find u − 2v + w for u = (1, 0, 3), v = (2, −1, 1) and w = (0, 4, −2).
- Write b = (7, 1) as a linear combination of v₁ = (1, 1) and v₂ = (3, −1).
- Is b = (2, 6) a linear combination of v₁ = (1, 3) and v₂ = (−2, −6)? Find all weights.
- Is b = (1, 4) a linear combination of v₁ = (1, 3) and v₂ = (−2, −6)?
- Is b = (3, 1, 4) a linear combination of a₁ = (1, 0, 1) and a₂ = (1, 1, 2)? Find the weights.
- Write b = (3, 5, 4) as a linear combination of a₁ = (1, 1, 0), a₂ = (0, 1, 1) and a₃ = (1, 0, 1).
- For what value of h is b = (2, −1, h) a linear combination of a₁ = (1, 0, −2) and a₂ = (0, 1, 3)?
- Find all ways to write b = (5, 3) as a linear combination of v₁ = (1, 0), v₂ = (0, 1) and v₃ = (1, 1).
- Smoothie mix A has 30 mg vitamin C and 2 g fiber per cup; mix B has 10 mg vitamin C and 4 g fiber per cup. How many cups of each give exactly 110 mg vitamin C and 14 g fiber?
Show answers
1.
2\mathbf{u} = \begin{bmatrix} 2 \\ -2 \end{bmatrix}Multiply each entry of u by 2.
3\mathbf{v} = \begin{bmatrix} 0 \\ 6 \end{bmatrix}Multiply each entry of v by 3.
2\mathbf{u} + 3\mathbf{v} = \begin{bmatrix} 2 + 0 \\ -2 + 6 \end{bmatrix} = \begin{bmatrix} 2 \\ 4 \end{bmatrix}Add entry by entry.
Answer: (2, 4)
2.
-2\mathbf{v} = \begin{bmatrix} -4 \\ 2 \\ -2 \end{bmatrix}Multiply each entry of v by −2.
\mathbf{u} - 2\mathbf{v} + \mathbf{w} = \begin{bmatrix} 1 - 4 + 0 \\ 0 + 2 + 4 \\ 3 - 2 - 2 \end{bmatrix}Add the three vectors entry by entry.
\mathbf{u} - 2\mathbf{v} + \mathbf{w} = \begin{bmatrix} -3 \\ 6 \\ -1 \end{bmatrix}Simplify each entry.
Answer: (−3, 6, −1)
3.
\left[\begin{array}{rr|r} 1 & 3 & 7 \\ 1 & -1 & 1 \end{array}\right]Augmented matrix [v₁ v₂ | b].
\left[\begin{array}{rr|r} 1 & 3 & 7 \\ 0 & -4 & -6 \end{array}\right]R₂ − R₁ → R₂.
\left[\begin{array}{rr|r} 1 & 3 & 7 \\ 0 & 1 & \tfrac{3}{2} \end{array}\right]−(1/4)R₂ → R₂.
\left[\begin{array}{rr|r} 1 & 0 & \tfrac{5}{2} \\ 0 & 1 & \tfrac{3}{2} \end{array}\right]R₁ − 3R₂ → R₁: 7 − 9/2 = 5/2.
Answer: b = (5/2)v₁ + (3/2)v₂. Check: 5/2 + 9/2 = 7 and 5/2 − 3/2 = 1.
4.
\left[\begin{array}{rr|r} 1 & -2 & 2 \\ 3 & -6 & 6 \end{array}\right]Augmented matrix.
\left[\begin{array}{rr|r} 1 & -2 & 2 \\ 0 & 0 & 0 \end{array}\right]R₂ − 3R₁ → R₂. No bad row, and x₂ is free.
x_1 = 2 + 2t,\; x_2 = t
Let x₂ = t; row 1 says x₁ − 2x₂ = 2.
Answer: yes, with weights (2 + 2t, t) for every real t; v₂ = −2v₁, so the two vectors point along the same line.
5.
\left[\begin{array}{rr|r} 1 & -2 & 1 \\ 3 & -6 & 4 \end{array}\right]Augmented matrix.
\left[\begin{array}{rr|r} 1 & -2 & 1 \\ 0 & 0 & 1 \end{array}\right]R₂ − 3R₁ → R₂: 4 − 3 = 1. Row 2 says 0 = 1.
Answer: no; b is not on the line through v₁ and v₂.
6.
\left[\begin{array}{rr|r} 1 & 1 & 3 \\ 0 & 1 & 1 \\ 1 & 2 & 4 \end{array}\right]Augmented matrix [a₁ a₂ | b].
\left[\begin{array}{rr|r} 1 & 1 & 3 \\ 0 & 1 & 1 \\ 0 & 1 & 1 \end{array}\right]R₃ − R₁ → R₃.
\left[\begin{array}{rr|r} 1 & 1 & 3 \\ 0 & 1 & 1 \\ 0 & 0 & 0 \end{array}\right]R₃ − R₂ → R₃.
\left[\begin{array}{rr|r} 1 & 0 & 2 \\ 0 & 1 & 1 \\ 0 & 0 & 0 \end{array}\right]R₁ − R₂ → R₁.
Answer: yes, b = 2a₁ + a₂.
7.
\left[\begin{array}{rrr|r} 1 & 0 & 1 & 3 \\ 1 & 1 & 0 & 5 \\ 0 & 1 & 1 & 4 \end{array}\right]Augmented matrix.
\left[\begin{array}{rrr|r} 1 & 0 & 1 & 3 \\ 0 & 1 & -1 & 2 \\ 0 & 1 & 1 & 4 \end{array}\right]R₂ − R₁ → R₂.
\left[\begin{array}{rrr|r} 1 & 0 & 1 & 3 \\ 0 & 1 & -1 & 2 \\ 0 & 0 & 2 & 2 \end{array}\right]R₃ − R₂ → R₃.
\left[\begin{array}{rrr|r} 1 & 0 & 1 & 3 \\ 0 & 1 & -1 & 2 \\ 0 & 0 & 1 & 1 \end{array}\right](1/2)R₃ → R₃.
\left[\begin{array}{rrr|r} 1 & 0 & 1 & 3 \\ 0 & 1 & 0 & 3 \\ 0 & 0 & 1 & 1 \end{array}\right]R₂ + R₃ → R₂.
\left[\begin{array}{rrr|r} 1 & 0 & 0 & 2 \\ 0 & 1 & 0 & 3 \\ 0 & 0 & 1 & 1 \end{array}\right]R₁ − R₃ → R₁.
Answer: b = 2a₁ + 3a₂ + a₃.
8.
\left[\begin{array}{rr|r} 1 & 0 & 2 \\ 0 & 1 & -1 \\ -2 & 3 & h \end{array}\right]Augmented matrix.
\left[\begin{array}{rr|r} 1 & 0 & 2 \\ 0 & 1 & -1 \\ 0 & 3 & h + 4 \end{array}\right]R₃ + 2R₁ → R₃.
\left[\begin{array}{rr|r} 1 & 0 & 2 \\ 0 & 1 & -1 \\ 0 & 0 & h + 7 \end{array}\right]R₃ − 3R₂ → R₃: h + 4 − 3(−1) = h + 7.
h + 7 = 0
Row 3 must not be a bad row.
h = -7
Subtract 7 from both sides.
Answer: h = −7, and then b = 2a₁ − a₂.
9.
\left[\begin{array}{rrr|r} 1 & 0 & 1 & 5 \\ 0 & 1 & 1 & 3 \end{array}\right]Augmented matrix [v₁ v₂ v₃ | b]; it is already in RREF, and x₃ is free.
x_1 = 5 - t,\; x_2 = 3 - t,\; x_3 = t
Let x₃ = t and solve each row.
Answer: b = (5 − t)v₁ + (3 − t)v₂ + tv₃ for every real t; for example, t = 0 gives 5v₁ + 3v₂ and t = 3 gives 2v₁ + 3v₃.
10.
x_1\begin{bmatrix} 30 \\ 2 \end{bmatrix} + x_2\begin{bmatrix} 10 \\ 4 \end{bmatrix} = \begin{bmatrix} 110 \\ 14 \end{bmatrix}x₁ cups of A and x₂ cups of B.
\left[\begin{array}{rr|r} 30 & 10 & 110 \\ 2 & 4 & 14 \end{array}\right]Augmented matrix.
\left[\begin{array}{rr|r} 2 & 4 & 14 \\ 30 & 10 & 110 \end{array}\right]R₁ ↔ R₂.
\left[\begin{array}{rr|r} 1 & 2 & 7 \\ 30 & 10 & 110 \end{array}\right](1/2)R₁ → R₁.
\left[\begin{array}{rr|r} 1 & 2 & 7 \\ 0 & -50 & -100 \end{array}\right]R₂ − 30R₁ → R₂: 10 − 60 = −50 and 110 − 210 = −100.
\left[\begin{array}{rr|r} 1 & 2 & 7 \\ 0 & 1 & 2 \end{array}\right]−(1/50)R₂ → R₂.
\left[\begin{array}{rr|r} 1 & 0 & 3 \\ 0 & 1 & 2 \end{array}\right]R₁ − 2R₂ → R₁.
Answer: 3 cups of A and 2 cups of B. Check: 90 + 20 = 110 and 6 + 8 = 14.
Linear combinations FAQ
What is a linear combination of vectors?
It is a sum of scalar multiples of the vectors, such as 2v₁ − 3v₂. The scalars are called the weights.
How do you know if a vector is a linear combination of other vectors?
Put the vectors as columns of an augmented matrix with b in the last column and row reduce. If no row reads [0 ⋯ 0 | c] with c ≠ 0, it is a linear combination.
Can the weights be zero or negative?
Yes. Weights can be any real numbers. The zero vector is a linear combination of any vectors, using all weights 0.
What is the difference between a vector equation and a linear system?
There is none in the solutions. The vector equation x₁v₁ + ⋯ + xₚvₚ = b is the linear system written column by column, so both have the same solution set.
Summary
- A linear combination is c₁v₁ + ⋯ + cₚvₚ, built from scalar multiples and vector addition.
- b is a linear combination of v₁, …, vₚ exactly when x₁v₁ + ⋯ + xₚvₚ = b has a solution.
- Solve it with the augmented matrix [v₁ ⋯ vₚ | b]: the vectors are columns.
- A row [0 ⋯ 0 | c] with c ≠ 0 means b is not a combination; a free variable means many sets of weights.
- Always check by computing the combination.
Previous lesson: Applications of Linear Systems
Next lesson: Span of Vectors
Back to the Linear Algebra Index