Express a target vector as a linear combination c1·v1 + c2·v2. Augment the column matrix [v1 | v2 | target] and row-reduce to back-substitute for the coefficients.

Example

Reduce the coefficient system and read weights.

highlighted = computed this step

Step 1 — Set up reduction

Set up the augmented matrix for row reduction.

R=[124237]R=\left[\begin{array}{cc|c}1&2&4\\2&3&7\end{array}\right]

Step 2 — Update row 2

Row-reduce with R2 <- R2 - 2*R1.

R=[1240-1-1]R=\left[\begin{array}{cc|c}1&2&4\\\hl{0}&\hl{-1}&\hl{-1}\end{array}\right]

Step 3 — Read coefficients

Read weights 2 and 1 from the reduced system.

c=[21]\vec{c}=\begin{bmatrix}\hl{2}\\\hl{1}\end{bmatrix}

Step 4 — State verdict

The target vector is a linear combination with weights 2 and 1.

weights=(2,1)\text{weights}=(2,1)
linear combination A vector b is a linear combination of v1, v2, … iff there exist scalars c1, c2, … such that c1·v1 + c2·v2 + … = b. Solving for the scalars requires row-reducing the augmented matrix [v1 | v2 | … | b].