The Dimensions steppers (▲ / ▼) set the rows and columns shared by A and B, each from 1 to 5; C takes the same shape. Learn more about choosing dimensions
Hover the ? icon for how a linear combination is built from scalar multiplication and matrix addition. Learn more about getting started
▶ 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
Each scene lights the active cell, with arrows from A and B into C in phase 3, and filled cells show αai,j, βbi,j or their sum. Learn more about reading a scene
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.
Set the shared shape of A and B, then watch αA+βB=C build in three phases.
• Use the Dimensions steppers to set the shape of A and B (1 to 5 in each direction). C 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 A by α, scale B by β, then add the scaled matrices into C • The scalars α and β 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 A by α: every cell of A is multiplied by α in place, one cell per scene; B stays untouched • Phase 2 — scale B by β: every cell of B is multiplied by β in place, one cell per scene; A is already fully scaled • Phase 3 — add into C: each cell of C is filled with αai,j+βbi,j, with two curved arrows flowing from A and B into C
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 A and B, the scalars α and β, and an empty C waiting to hold αA+βB.
At the default dimensionsA and B are both 2×3, and so is C. The caption states the plan up front — the combination will be built in three phases rather than in one pass.
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 A and B 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 A by α, one cell at a time, exactly as the scalar-multiplication tool does on its own.
Six steps at the default size. B is untouched throughout, and C is still empty — this phase produces αA as an intermediate result, not part of the answer yet.
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 A already carry their α factor, one is being scaled, and the rest are untouched.
Phase 2: Scaling B by β
The second sweep repeats the operation on B with the other scalar, producing βB. Another six steps, and A is now left alone — the caption notes it is already fully scaled from phase 1.
C remains empty. Both inputs have now been scaled, but nothing has been combined.
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 α and β 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 α and β over all real numbers sweeps out every matrix expressible from A and B this way — the span of the pair, which for two independent matrices is a two-dimensional subspace of the 2×3 matrices.
Phase 3: Adding the Two Scaled Matrices
The third sweep finally fills C, adding the two intermediates entry by entry: ci,j=αai,j+βbi,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.
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 is one more scaling phase and one more addition.
It is also worth noticing what the entrywise formula licenses. Because each cell of C depends only on the matching cells of A and B, 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 A is highlighted primary; the rest of the canvas stays neutral • In phase 2, the active cell of B is highlighted secondary • In phase 3, the active cells of A and B are highlighted primary and secondary, and the destination cell of C is accent; arrows flow from both sources into C • Filled cells show their symbolic content — αai,j, βbi,j, or αai,j+βbi,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×2, 2×3) make the per-cell flow easy to follow in each phase • Larger shapes (4×4, 5×5) demonstrate that the same rule scales; total scenes equal 3×m×n plus the intro and outro • Cell content shrinks automatically as the matrix grows so αai,j+βbi,j stays readable at the largest shape • Square and rectangular shapes follow identical rules — linear combinations require only matching shapes between operands
More generally, a linear combination of n matrices is
C=c1A1+c2A2+⋯+cnAn
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×n matrices is again m×n • Commutativity: αA+βB=βB+αA • Associativity: combining linear combinations gives another linear combination • Zero coefficient: if α=0, the matrix A drops out entirely • Scaling a linear combination: k(αA+βB)=(kα)A+(kβ)B • Distributivity: α(A+B)=αA+αB
The structural fact behind all of this is that the set of m×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=0 forces all ci=0 • Solving linear systems: a system Ax=b asks whether b is a linear combination of the columns of A • 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 A, B as 2×2 matrices and α=2, β=−1:
A=(1034),B=(5120)
Scale A by 2:
2A=(2068)
Scale B by −1:
−B=(−5−1−20)
Add:
2A−B=(−3−148)
Set the visualizer to 2×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; 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
Related Concepts
Matrix addition — the additive piece of any linear combination.