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 an 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