Tutorials › Linear Algebra › Scaling Variables and Equations

LU Factorization and Numerical Considerations · Tutorial 923 of 1000

Scaling Variables and Equations

See how to scale equations and unknowns without changing the system’s solutions, and how to choose scales that make their sizes and units more useful.

Intermediate 10 min read

What You'll Learn

  • Write equation scaling and variable scaling with diagonal matrices.
  • Derive the transformed system and map its solution back to the original variables.
  • Prove when scaling preserves the exact solution set and uniqueness.
  • Work through row-only, variable-only and combined scaling.
  • Recognise how scaling affects units, coefficient sizes and residual interpretation.
  • Avoid confusing scaled coordinates with the original unknowns.

Why Scale a Linear System?

A linear system may describe quantities measured in very different units or at very different typical sizes. One unknown might be measured in thousands, while another is close to one; one equation might have coefficients in the thousands, while another has coefficients near one. Those differences can make a system harder to read or work with. Scaling changes the representation so the quantities are more comparable, while keeping careful track of how the transformed problem relates to the original.

Write a square system as \(\mathbf{A}\mathbf{x}=\mathbf{b}\), where \(\mathbf{A}\in\mathbb{R}^{n\times n}\), \(\mathbf{x}\in\mathbb{R}^n\) is the column of unknowns, and \(\mathbf{b}\in\mathbb{R}^n\) is the right-hand side. The scaling arguments below also apply to rectangular systems. An equation can be rescaled by multiplying both sides by a nonzero number. An unknown can be rescaled by expressing it as a nonzero scale factor times a new coordinate. These are different operations: the first changes the equations’ representation, while the second changes the coordinates used for the unknowns.

Definition: An equation scaling is multiplication of \(\mathbf{A}\mathbf{x}=\mathbf{b}\) on the left by an invertible diagonal matrix \(\mathbf{S}\). A variable scaling introduces new coordinates \(\mathbf{y}\) through \(\mathbf{x}=\mathbf{D}\mathbf{y}\), where \(\mathbf{D}\) is an invertible diagonal matrix. When both are used, the transformed system is \(\mathbf{S}\mathbf{A}\mathbf{D}\mathbf{y}=\mathbf{S}\mathbf{b}\), and the original unknown is recovered as \(\mathbf{x}=\mathbf{D}\mathbf{y}\).

The diagonal entries of \(\mathbf{S}\) and \(\mathbf{D}\) are the scale factors. They must all be nonzero: this makes \(\mathbf{S}\) and \(\mathbf{D}\) invertible. Positive scale factors are usual when scales represent units or typical magnitudes, though the algebraic equivalence only requires nonzero entries. Multiplying on the left scales rows, because it multiplies each equation by its corresponding factor. Multiplying on the right scales columns, because it multiplies each unknown’s column of coefficients by its factor.

What the Transformations Preserve

Theorem: Let \(\mathbf{A}\in\mathbb{R}^{m\times n}\), \(\mathbf{b}\in\mathbb{R}^m\), and let \(\mathbf{S}\in\mathbb{R}^{m\times m}\) and \(\mathbf{D}\in\mathbb{R}^{n\times n}\) be invertible diagonal matrices. Then \(\mathbf{x}\) solves \(\mathbf{A}\mathbf{x}=\mathbf{b}\) if and only if \(\mathbf{y}=\mathbf{D}^{-1}\mathbf{x}\) solves \(\mathbf{S}\mathbf{A}\mathbf{D}\mathbf{y}=\mathbf{S}\mathbf{b}\). The correspondence between solutions is \(\mathbf{x}=\mathbf{D}\mathbf{y}\).

Proof. Suppose \(\mathbf{x}\) solves \(\mathbf{A}\mathbf{x}=\mathbf{b}\), and define \(\mathbf{y}=\mathbf{D}^{-1}\mathbf{x}\). Then \(\mathbf{D}\mathbf{y}=\mathbf{x}\), so \(\mathbf{S}\mathbf{A}\mathbf{D}\mathbf{y}=\mathbf{S}\mathbf{A}\mathbf{x}=\mathbf{S}\mathbf{b}\). Conversely, suppose \(\mathbf{y}\) solves the transformed system and set \(\mathbf{x}=\mathbf{D}\mathbf{y}\). Then \(\mathbf{S}\mathbf{A}\mathbf{x}=\mathbf{S}\mathbf{b}\). Since \(\mathbf{S}\) is invertible, multiply by \(\mathbf{S}^{-1}\) to obtain \(\mathbf{A}\mathbf{x}=\mathbf{b}\). The assignments \(\mathbf{x}=\mathbf{D}\mathbf{y}\) and \(\mathbf{y}=\mathbf{D}^{-1}\mathbf{x}\) undo each other, so this is a one-to-one correspondence between the two solution sets. \(\square\)

In particular, these transformations preserve whether a system has no solution, exactly one solution, or more than one solution. They do not make a nonexistent solution appear. If a unique solution is obtained in scaled coordinates, it must still be converted back to the original unknowns before interpretation.

Scaling Equations: Changing Row Magnitudes

Worked Example: Rescaling One Equation

Consider \(1000x+2y=1004\) and \(3x+y=5\). Divide the first equation by \(1000\), leaving the second unchanged. In matrix form this uses \(\mathbf{S}=\begin{bmatrix}\tfrac{1}{1000}&0\\0&1\end{bmatrix}\):

$$ \begin{bmatrix}1000&2\\3&1\end{bmatrix} \begin{bmatrix}x\\y\end{bmatrix} = \begin{bmatrix}1004\\5\end{bmatrix} \quad\longrightarrow\quad \begin{bmatrix}1&\tfrac{1}{500}\\3&1\end{bmatrix} \begin{bmatrix}x\\y\end{bmatrix} = \begin{bmatrix}\tfrac{251}{250}\\5\end{bmatrix}. $$

The second scaled equation gives \(y=5-3x\). Substitute this into the first: \(x+\tfrac{1}{500}(5-3x)=\tfrac{251}{250}\). Multiplying by \(500\) gives \(500x+5-3x=502\), so \(497x=497\), \(x=1\), and \(y=5-3=2\).

Check: In the original system, \(1000(1)+2(2)=1004\) and \(3(1)+2=5\). Both equations hold. Dividing an equation by a nonzero number changes its written size, not its solutions.

Equation scaling is useful when equations have different units or widely different coefficient sizes. For instance, an equation measured in millimetres might be rescaled to metres to match the units of other equations. But a smaller row is not automatically a more informative row: rescaling changes the numerical size of its residual as well. If the original residual is \(\mathbf{r}=\mathbf{b}-\mathbf{A}\mathbf{x}\), then the scaled residual is \(\mathbf{S}\mathbf{r}\). Comparisons of residual sizes therefore depend on the scaling chosen.

Scaling Variables: Changing Coordinates

Worked Example: Expressing a Large Unknown in Thousands

Consider the system \(\tfrac{1}{1000}x+y=2\) and \(\tfrac{1}{500}x+y=3\). Since \(x\) is expected to be on the scale of a thousand, introduce \(x=1000z\), while leaving \(y\) unchanged. Thus \(\mathbf{x}=\mathbf{D}\mathbf{y}\) with \(\mathbf{D}=\begin{bmatrix}1000&0\\0&1\end{bmatrix}\), where the new coordinate vector is \(\mathbf{y}=\begin{bmatrix}z\\y\end{bmatrix}\). The transformed system is

$$ \begin{bmatrix}\tfrac{1}{1000}&1\\\tfrac{1}{500}&1\end{bmatrix} \begin{bmatrix}1000&0\\0&1\end{bmatrix} \begin{bmatrix}z\\y\end{bmatrix} = \begin{bmatrix}2\\3\end{bmatrix}, \qquad \begin{bmatrix}1&1\\2&1\end{bmatrix} \begin{bmatrix}z\\y\end{bmatrix} = \begin{bmatrix}2\\3\end{bmatrix}. $$

The equations are \(z+y=2\) and \(2z+y=3\). Subtracting the first from the second gives \(z=1\); then \(y=2-1=1\). Convert back: \(x=1000z=1000\). Thus the original unknowns are \(x=1000\) and \(y=1\).

Check: Substitution in the original equations gives \(\tfrac{1}{1000}(1000)+1=2\) and \(\tfrac{1}{500}(1000)+1=3\). Both equations hold. The value \(z=1\) is a scaled coordinate, not the original value of \(x\).

The choice \(x=1000z\) expresses the original unknown in units of a thousand. More generally, if typical values of the original unknowns are \(d_1,\dots,d_n\), it can be useful to write \(x_j=d_jy_j\). Values of the new coordinates near one then represent unknowns near their chosen scales. Such a choice can make a model easier to read and can reduce large differences among column magnitudes.

Combining Equation and Variable Scales

Worked Example: Scaling Rows and Unknowns Together

Consider \(1000x+2y=2004\) and \(3x+\tfrac{3}{1000}y=\tfrac{3003}{500}\). Scale the first equation by \(\tfrac{1}{1000}\) and the second by \(\tfrac{1}{3}\). Also set \(x=z_1\) and \(y=1000z_2\), so \(\mathbf{x}=\mathbf{D}\mathbf{z}\), where \(\mathbf{D}=\begin{bmatrix}1&0\\0&1000\end{bmatrix}\). With \(\mathbf{S}=\begin{bmatrix}\tfrac{1}{1000}&0\\0&\tfrac{1}{3}\end{bmatrix}\), the transformed system is

$$ \mathbf{S}\mathbf{A}\mathbf{D} = \begin{bmatrix}1&2\\1&1\end{bmatrix}, \qquad \mathbf{S}\mathbf{b} = \begin{bmatrix}\tfrac{501}{250}\\\tfrac{1001}{500}\end{bmatrix}. $$

Thus \(z_1+2z_2=\tfrac{501}{250}=\tfrac{1002}{500}\) and \(z_1+z_2=\tfrac{1001}{500}\). Subtracting the second equation from the first gives \(z_2=\tfrac{1}{500}\). Then \(z_1=\tfrac{1001}{500}-\tfrac{1}{500}=2\). Convert back: \(x=z_1=2\) and \(y=1000z_2=2\).

Check: In the original system, \(1000(2)+2(2)=2004\). The second left-hand side is \(3(2)+\tfrac{3}{1000}(2)=6+\tfrac{6}{1000}=\tfrac{3003}{500}\). Both original equations hold.

This example illustrates two distinct choices. The row factors bring the equations to more comparable sizes, while the variable factor expresses \(y\) in units of a thousand. The resulting matrix has moderate, easy-to-read entries. That is a practical benefit, not a guarantee that every computation becomes more accurate or that every measure of conditioning improves. The effect depends on the system, the scales, and how numerical sizes are measured.

Takeaway: For \(\mathbf{A}\mathbf{x}=\mathbf{b}\), choose invertible diagonal matrices \(\mathbf{S}\) and \(\mathbf{D}\), solve \(\mathbf{S}\mathbf{A}\mathbf{D}\mathbf{y}=\mathbf{S}\mathbf{b}\), and recover \(\mathbf{x}=\mathbf{D}\mathbf{y}\). Equation scales act on rows; variable scales act on columns. Both are reversible, but they serve different interpretive purposes.

Common Pitfall: Returning the Scaled Coordinates

Suppose \(2x+y=5\) and \(x-y=1\), and choose \(x=10z\). Since \(x=10z\), the correct transformed coefficient matrix is obtained by multiplying the first column by \(10\): \(\begin{bmatrix}20&1\\10&-1\end{bmatrix}\). The transformed equations give \(20z+y=5\) and \(10z-y=1\). Adding gives \(30z=6\), so \(z=\tfrac{1}{5}\), and then \(y=1\). The original unknown is \(x=10z=2\).

A tempting but wrong calculation is to multiply the first column by \(\tfrac{1}{10}\) instead, as if \(x=\tfrac{1}{10}z\). That would produce \(\begin{bmatrix}\tfrac{1}{5}&1\\\tfrac{1}{10}&-1\end{bmatrix}\), which does not represent the stated substitution \(x=10z\). Another error is to report \(z=\tfrac{1}{5}\) as the value of \(x\). Checking against the original equations catches it: \(2(\tfrac{1}{5})+1=\tfrac{7}{5}\ne5\). The correction is to use \(\mathbf{A}\mathbf{D}\) when \(\mathbf{x}=\mathbf{D}\mathbf{y}\), then convert the computed coordinates back with \(\mathbf{x}=\mathbf{D}\mathbf{y}\).

Choosing Scales with Care

Useful scales come from the meaning and typical size of the quantities, not from a rule that every entry must look alike. Before scaling, identify which unknowns are measured in different units or are expected to have different magnitudes. For equation scaling, identify whether multiplying an equation changes how its residual should be interpreted. After solving, check the recovered answer in the original system, not only in the scaled one.

Scaling can improve interpretation by making coordinates represent natural units, and it can make a matrix easier to inspect by reducing extreme differences in row or column sizes. It is not the same as changing the underlying model: with nonzero scale factors and the correct conversion back, the exact solutions correspond one-to-one. But a scale chosen without regard to units or meaning can obscure the model, and scaling alone does not guarantee a better-conditioned system or a more reliable computation.

Check Your Understanding

For each question, keep track of which quantities are original variables and which are scaled coordinates.

  1. If the second equation of a system is multiplied by \(5\), what must happen to its right-hand side for the solution set to remain unchanged?
  2. For \(\mathbf{A}\mathbf{x}=\mathbf{b}\), explain why the substitution \(\mathbf{x}=\mathbf{D}\mathbf{y}\) produces the matrix \(\mathbf{A}\mathbf{D}\), not \(\mathbf{A}\mathbf{D}^{-1}\).
  3. If \(x=100y_1\) and a calculation gives \(y_1=3\), what is the original value of \(x\)?
  4. State why every diagonal entry of an equation-scaling matrix must be nonzero for the equivalence theorem to apply.
  5. Give one reason equation scaling can help interpretation and one reason it does not guarantee improved numerical accuracy.

Test yourself: Linear Algebra final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon