This article is part 2 in the series about transformation matrices:
- Part 1: Coordinate systems and transformations between them
- Part 2: Scaling objects with a transformation matrix (this article)
- Part 3: Shearing objects with a transformation matrix
- Part 4: Translating objects with a transformation matrix
- Part 5: Combining Matrix Transformations
Scaling Along the Cardinal Axes
Intuitively, the basis vectors should be multiplied by a scalar. Also, they are independently affected by the scale factors.
In 2D, the basis vectors become:
Constructing the 2D scale matrix
Similarly, the 3D scale matrix is given by:
Scaling Along an Arbitrary Axis
Let

Scale Arbitrary Axis
Separate
Where:
We can also represent
Note that any vector that lies in the 2D line or 3D plane perpendicular to
Since
Reconstructing the solution from the observations above:
We can construct a general scale matrix by computing the vectors resulting after transforming the basis vectors
Similarly, the values of