Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools


Linear Combinations of Matrices

How to use
  1. The Dimensions steppers (▲ / ▼) set the rows and columns shared by AA and BB, each from 1 to 5; CC takes the same shape. Learn more about choosing dimensions
  2. Hover the ? icon for how a linear combination is built from scalar multiplication and matrix addition. Learn more about getting started
  3. ▶ Play runs the animation, Next → and ← Back move one cell at a time, Reset returns to the opening scene, and the speed menu sets the pace from Slow to Very Fast. Learn more about the controls
  4. The run has three phases: scale AA by α\alpha, scale BB by β\beta, then add the scaled matrices into CC. Learn more about the three phases
  5. Each scene lights the active cell, with arrows from AA and BB into CC in phase 3, and filled cells show αai,j\alpha a_{i,j}, βbi,j\beta b_{i,j} or their sum. Learn more about reading a scene
  6. The Step explanations log keeps every completed step across all three phases, with a note linking to the matching section below. Learn more about the step log


Symbolic visualization of α·A + β·B = C, in three phases: scale, scale, add.

Dimensions (shared by A and B)?A linear combination is α·A + β·B, where α and β are scalars. The two operands must share the same shape so that the addition is defined; the result has that same shape. Linear combinations are built from two operations already covered: scalar multiplication (scale each operand) and addition (add the scaled operands). The same idea applies to vectors and to matrices — only the shape of the operands differs.
A, B2×3
α·
A2×3
a1,1
a1,2
a1,3
a2,1
a2,2
a2,3
+β·
B2×3
b1,1
b1,2
b1,3
b2,1
b2,2
b2,3
=
C2×3
?
?
?
?
?
?
Step 1 / 20

Step explanations

1Linear combination α·A + β·B
A and B are 2×3. The linear combination α·A + β·B is built in three phases: scale A by α, scale B by β, then add the two scaled matrices. The result C has the same shape.
Scalars impose no shape rule; the addition in phase 3 does, and that is the binding constraint. Learn more about the opening scene · the three phases









Key Terms

Linear combination — an expression αA+βB\alpha A + \beta B that scales each matrix by a scalar and adds the results. More generally, c1A1+c2A2+⋯+cnAnc_1 A_1 + c_2 A_2 + \cdots + c_n A_n.

Scalar coefficient — the numbers α,β\alpha, \beta (or cic_i) that multiply each matrix in the combination.

Same-shape requirement — all matrices in a linear combination must share identical dimensions so the additions are defined.

Result shape — the linear combination has the same shape as the operands.

Span — the set of all linear combinations of a fixed collection of matrices.

Linear independence — a property of a collection: no matrix in it can be written as a linear combination of the others.

Vector space of matrices — the set of all m×nm \times n matrices forms a vector space under matrix addition and scalar multiplication; linear combinations are its native operation.

Getting Started with the Visualizer

DemoShape, play, reset
Step 0 of 5
Set the shared shape of AA and BB, then watch αA+βB=C\alpha A + \beta B = C build in three phases.

• Use the Dimensions steppers to set the shape of AA and BB (1 to 5 in each direction). CC inherits the shape automatically
• Hover the ? icon for a reminder that linear combinations are built from scalar multiplication plus matrix addition
• Press play or step manually through the scene player
• The animation walks three phases in order: scale AA by α\alpha, scale BB by β\beta, then add the scaled matrices into CC
• The scalars α\alpha and β\beta are shown symbolically — the visualizer focuses on structure, not specific numeric values

The Three Phases

DemoScale, scale, add
Step 0 of 5
The visualizer breaks the operation into three clearly separated phases.

• Phase 1 — scale AA by α\alpha: every cell of AA is multiplied by α\alpha in place, one cell per scene; BB stays untouched
• Phase 2 — scale BB by β\beta: every cell of BB is multiplied by β\beta in place, one cell per scene; AA is already fully scaled
• Phase 3 — add into CC: each cell of CC is filled with αai,j+βbi,j\alpha a_{i,j} + \beta b_{i,j}, with two curved arrows flowing from AA and BB into CC

This phase order makes the decomposition of a linear combination into scalar multiplication and matrix addition explicit. Both operations are visible on the screen at the same time when phase 3 begins.

The Opening Scene: Two Matrices and Two Scalars

The player starts with everything named and nothing computed: the matrices AA and BB, the scalars α\alpha and β\beta, and an empty CC waiting to hold αA+βB\alpha A + \beta B.

At the default dimensions AA and BB are both 2×32 \times 3, and so is CC. The caption states the plan up front — the combination will be built in three phases rather than in one pass.
α·A2×3a1,1a1,2a1,3a2,1a2,2a2,3+β·B2×3b1,1b1,2b1,3b2,1b2,2b2,3=C2×3??????
Opening scene, frozen

A, B and an empty C, all 2×3, with the two scalars named. Nothing computed yet - the caption announces the three phases before any of them runs.

Two preconditions are quietly in force here, one from each operation being combined. The scalars can be anything, because scalar multiplication imposes no shape rule. But AA and BB must have identical dimensions, because the final phase adds them, and addition does.

That is the general shape of a linear combination: scalar multiplication is permissive, addition is strict, and the strict one governs. Everything the tool does after this scene is a consequence of that pairing.

Phase 1: Scaling A by α

The first sweep multiplies every entry of AA by α\alpha, one cell at a time, exactly as the scalar-multiplication tool does on its own.

Six steps at the default size. BB is untouched throughout, and CC is still empty — this phase produces αA\alpha A as an intermediate result, not part of the answer yet.
α·A2×3α·a1,1α·a1,2α·a1,3α·a2,1a2,2a2,3+β·B2×3b1,1b1,2b1,3b2,1b2,2b2,3=C2×3??????
Phase 1, mid-sweep

Entries of A picking up their α factor one at a time. B is untouched and C is still empty: this phase produces an intermediate, not an answer.

Isolating this phase is the pedagogical point of the three-phase structure. A linear combination is not a new primitive operation; it is scalar multiplication and addition applied in sequence, and the tool refuses to blur them together.

The frozen picture below is a step partway through this sweep: some entries of AA already carry their α\alpha factor, one is being scaled, and the rest are untouched.

Phase 2: Scaling B by β

The second sweep repeats the operation on BB with the other scalar, producing βB\beta B. Another six steps, and AA is now left alone — the caption notes it is already fully scaled from phase 1.

CC remains empty. Both inputs have now been scaled, but nothing has been combined.
α·A2×3α·a1,1α·a1,2α·a1,3α·a2,1α·a2,2α·a2,3+β·B2×3β·b1,1β·b1,2β·b1,3β·b2,1b2,2b2,3=C2×3??????
Phase 2, mid-sweep

The same sweep on B with β. A is left alone now, fully scaled from phase 1, and C is still waiting.

The two scalars are independent. Nothing requires α\alpha and β\beta to be related, equal, or even non-zero, and setting one of them to zero collapses the combination to a plain scalar multiple of the other matrix.

That independence is what gives linear combinations their reach. Varying α\alpha and β\beta over all real numbers sweeps out every matrix expressible from AA and BB this way — the span of the pair, which for two independent matrices is a two-dimensional subspace of the 2×32 \times 3 matrices.

Phase 3: Adding the Two Scaled Matrices

The third sweep finally fills CC, adding the two intermediates entry by entry: ci,j=αai,j+βbi,jc_{i,j} = \alpha a_{i,j} + \beta b_{i,j}.

This phase is ordinary matrix addition, and it is where the same-shape requirement is actually consumed. Six more steps, and the combination is complete.
α·A2×3α·a1,1α·a1,2α·a1,3α·a2,1α·a2,2α·a2,3+β·B2×3β·b1,1β·b1,2β·b1,3β·b2,1β·b2,2β·b2,3=C2×3α·a1,1+β·b1,1α·a1,2+β·b1,2α·a1,3+β·b1,3α·a2,1+β·b2,1??
Phase 3, mid-sweep

C finally filling, each cell reading αa + βb. This is plain matrix addition, and the step where the same-shape rule is actually used.

Read across the three phases and the definition assembles itself: scale, scale, add. That is all a linear combination is, and extending it to more terms changes nothing structurally — αA+βB+γD\alpha A + \beta B + \gamma D is one more scaling phase and one more addition.

It is also worth noticing what the entrywise formula licenses. Because each cell of CC depends only on the matching cells of AA and BB, the whole operation could be done in any order, or in parallel. The three-phase sequence is a teaching device; the arithmetic has no dependencies to respect.

Reading the Scene Player

Each scene combines highlights, arrows, and a caption.

• In phase 1, the active cell of AA is highlighted primary; the rest of the canvas stays neutral
• In phase 2, the active cell of BB is highlighted secondary
• In phase 3, the active cells of AA and BB are highlighted primary and secondary, and the destination cell of CC is accent; arrows flow from both sources into CC
• Filled cells show their symbolic content — αai,j\alpha a_{i,j}, βbi,j\beta b_{i,j}, or αai,j+βbi,j\alpha a_{i,j} + \beta b_{i,j} — at a font size that scales with the matrix dimensions
• The step log on the right keeps a record of every completed cell across all phases

Choosing Dimensions

DemoShaping A and B
Step 0 of 5
The dimension steppers control the shape shared by all three matrices.

• Smaller shapes (2×22 \times 2, 2×32 \times 3) make the per-cell flow easy to follow in each phase
• Larger shapes (4×44 \times 4, 5×55 \times 5) demonstrate that the same rule scales; total scenes equal 3×m×n3 \times m \times n plus the intro and outro
• Cell content shrinks automatically as the matrix grows so αai,j+βbi,j\alpha a_{i,j} + \beta b_{i,j} stays readable at the largest shape
• Square and rectangular shapes follow identical rules — linear combinations require only matching shapes between operands

What a Linear Combination Is

A linear combination of two matrices AA and BB of the same shape is

C=αA+βB,ci,j=α⋅ai,j+β⋅bi,jC = \alpha A + \beta B, \quad c_{i,j} = \alpha \cdot a_{i,j} + \beta \cdot b_{i,j}


More generally, a linear combination of nn matrices is

C=c1A1+c2A2+⋯+cnAnC = c_1 A_1 + c_2 A_2 + \cdots + c_n A_n


All matrices must share the same shape, and the result inherits that shape. The operation is built from two simpler ones: scale each matrix by its coefficient, then add the scaled matrices entry by entry.

Linear combinations are the native operation of any vector space — matrices, vectors, polynomials, and functions all support them. For comprehensive theory, see matrix operations.

Key Properties

Linear combinations inherit their properties from scalar multiplication and matrix addition.

• Closure: a linear combination of m×nm \times n matrices is again m×nm \times n
• Commutativity: αA+βB=βB+αA\alpha A + \beta B = \beta B + \alpha A
• Associativity: combining linear combinations gives another linear combination
• Zero coefficient: if α=0\alpha = 0, the matrix AA drops out entirely
• Scaling a linear combination: k(αA+βB)=(kα)A+(kβ)Bk(\alpha A + \beta B) = (k\alpha) A + (k\beta) B
• Distributivity: α(A+B)=αA+αB\alpha(A + B) = \alpha A + \alpha B

The structural fact behind all of this is that the set of m×nm \times n matrices forms a vector space, and linear combinations are exactly the operation that vector spaces are designed to support.

Why It Matters

Linear combinations are the foundation on which most of linear algebra is built.

• Span and basis: the span of a set of matrices is the set of all their linear combinations; a basis is a linearly independent set whose span is the whole space
• Linear independence: testing whether c1A1+⋯+cnAn=0c_1 A_1 + \cdots + c_n A_n = 0 forces all ci=0c_i = 0
• Solving linear systems: a system Ax=bAx = b asks whether bb is a linear combination of the columns of AA
• Subspaces: a subspace is a set closed under linear combinations
• Coordinate representations: writing a matrix as a linear combination of basis matrices gives its coordinates
• Differential equations, optimization, machine learning: every linear model, every superposition principle, every gradient update is a linear combination

Worked Example

Take AA, BB as 2×22 \times 2 matrices and α=2\alpha = 2, β=−1\beta = -1:

A=(1304),B=(5210)A = \begin{pmatrix} 1 & 3 \\ 0 & 4 \end{pmatrix}, \quad B = \begin{pmatrix} 5 & 2 \\ 1 & 0 \end{pmatrix}


Scale AA by 2:

2A=(2608)2A = \begin{pmatrix} 2 & 6 \\ 0 & 8 \end{pmatrix}


Scale BB by −1-1:

−B=(−5−2−10)-B = \begin{pmatrix} -5 & -2 \\ -1 & 0 \end{pmatrix}


Add:

2A−B=(−34−18)2A - B = \begin{pmatrix} -3 & 4 \\ -1 & 8 \end{pmatrix}


Set the visualizer to 2×22 \times 2 and step through to see the three phases animated symbolically.

Common Mistakes

A few mistakes recur.

• Mixing shapes — every matrix in the combination must have the same shape; no broadcasting
• Distributing scalars unevenly — α(A+B)≠αA+B\alpha(A + B) \neq \alpha A + B; the scalar applies to every matrix it multiplies
• Confusing linear combination with matrix product — a linear combination scales and adds, no row-column interaction
• Treating a single scalar product as a linear combination of one matrix — technically valid but trivial; the interesting case has at least two matrices
• Forgetting that the zero matrix is a trivial linear combination — choosing all coefficients zero produces the zero matrix regardless of the operands