# Transformation Matrix: Types, Formulas & Examples

## What a Transformation Matrix Is

A transformation matrix is a square matrix that maps the coordinates of a vector to new coordinates by matrix multiplication. When a transformation matrix \( T \) of order \( n \times n \) multiplies a column vector \( \mathbf{v} \) with \( n \) components, it produces a new vector \( \mathbf{v}' \) in the same space:

\[ \mathbf{v}' = T \mathbf{v} \]

For a flat 2D plane, \( T \) is a \( 2 \times 2 \) matrix. For 3D space, it is \( 3 \times 3 \). The transformation acts on the whole coordinate system at once. A [rotation matrix](/content/math/algebra/rotation-matrix/index.html) is a common example that turns without distorting.

The columns of \( T \) indicate where the basis vectors go.

## How Do You Apply a Transformation Matrix to a Vector?

To apply a transformation matrix, place the vector's coordinates in a column and multiply on the left:

\[ T \mathbf{v} = \begin{bmatrix} a & b \\ c & d \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix} = \begin{bmatrix} ax + by \\ cx + dy \end{bmatrix} \]

The order matters: the matrix sits on the left, the column vector on the right. For the full mechanics of multiplying, see [multiplication of matrices](/content/math/algebra/multiplication-of-matrices/index.html).

## The Types of Transformation Matrix

There are five transformations you will frequently encounter:

- **Scaling:** Enlarges or shrinks distances along the axes. Scale by \( k_x \) along x and \( k_y \) along y:
  \[ \begin{bmatrix} k_x & 0 \\ 0 & k_y \end{bmatrix} \]

- **Rotation:** Turns the figure about the origin by angle \( \theta \):  
  \[ \begin{bmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{bmatrix} \]

- **Shear:** Slides one coordinate in proportion to the other:
  - A shear along x: \[ \begin{bmatrix} 1 & k \\ 0 & 1 \end{bmatrix} \]  
  - A shear along y: \[ \begin{bmatrix} 1 & 0 \\ k & 1 \end{bmatrix} \]

- **Reflection:** Mirrors the figure across an axis:
  - In the x-axis: \[ \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix} \]  
  - In the y-axis: \[ \begin{bmatrix} -1 & 0 \\ 0 & 1 \end{bmatrix} \]  
  - Across the line \( y = x \): \[ \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} \]

- **Translation:** Shifts a figure without rotating or resizing. It cannot be represented as a \( 2 \times 2 \) matrix and requires homogeneous coordinates:
  \[ \begin{bmatrix} 1 & 0 & t_x \\ 0 & 1 & t_y \\ 0 & 0 & 1 \end{bmatrix} \]

## What Are the Properties of a Transformation Matrix?

### Properties:
- **The determinant measures area change.** For a \( 2 \times 2 \) matrix, \( \text{det} \ T \) indicates how area scales.
- **A zero determinant collapses the figure.** If \( \text{det} T = 0 \), the transformation cannot be undone.
- **Invertible transformations have an inverse matrix.** When \( \text{det} T \neq 0 \), the transformation can be reversed.
- **Composition is matrix multiplication.** Applying transformations is non-commutative, so the order matters.
- **The identity matrix leaves everything fixed:**  \[ \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} \]

## Examples of Transformation Matrix

### Example 1
**Apply the scaling matrix \[ \begin{bmatrix} 2 & 0 \\ 0 & 3 \end{bmatrix} \] to the point \( (1,1) \).**  
\[ \begin{bmatrix} 2 & 0 \\ 0 & 3 \end{bmatrix} \begin{bmatrix} 1 \\ 1 \end{bmatrix} = \begin{bmatrix} 2 \\ 3 \end{bmatrix} \]
**Final answer:** (2,3).

### Example 2
**Reflect \( (4,1) \) across the line \( y = x \).**  
Using the reflection matrix \[ \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} \]:  
\[ \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} \begin{bmatrix} 4 \\ 1 \end{bmatrix} = \begin{bmatrix} 1 \\ 4 \end{bmatrix} \]  
**Final answer:** (1,4).

### Example 3
**Apply the shear \[ \begin{bmatrix} 1 & 2 \\ 0 & 1 \end{bmatrix} \] to the point \( (3,2) \).**  
\[ \begin{bmatrix} 1 & 2 \\ 0 & 1 \end{bmatrix} \begin{bmatrix} 3 \\ 2 \end{bmatrix} = \begin{bmatrix} 7 \\ 2 \end{bmatrix} \]  
**Final answer:** (7,2).

### Example 4
**Find the constant \( a \) in the shear \[ \begin{bmatrix} 1 & a \\ 0 & 1 \end{bmatrix} \] that maps \( (3,2) \) to \( (7,2) \).** 
From the equation \( 3 + 2a = 7 \):  
\[ 2a = 4 ightarrow a = 2 \]  
**Final answer:** a=2.

### Example 5
**Transform the vector \( 5i + 4j \) using \( T = \begin{bmatrix} 2 & -3 \\ 1 & 2 \end{bmatrix} \).**  
\[ \begin{bmatrix} 2 & -3 \\ 1 & 2 \end{bmatrix} \begin{bmatrix} 5 \\ 4 \end{bmatrix} = \begin{bmatrix} -2 \\ 13 \end{bmatrix} \]  
**Final answer:** -2i + 13j.

### Example 6
**Compose a reflection in the x-axis with a scaling by 2, then apply to (1,3).**  
Combine matrices and apply:
\[ \begin{bmatrix} 2 & 0 \\ 0 & -2 \end{bmatrix} \begin{bmatrix} 1 \\ 3 \end{bmatrix} = \begin{bmatrix} 2 \\ -6 \end{bmatrix} \]  
**Final answer:** (2,-6).

## Practice Questions on Transformation Matrix

1. Scale the point (2,5) by a factor of 3 along both axes.
2. Reflect the point (6,2) across the y-axis.
3. Apply the shear \[ \begin{bmatrix} 1 & 3 \\ 0 & 1 \end{bmatrix} \] to the point (2,4).
4. Compose a rotation by 90° with the shear \[ \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix} \] (shear first, then rotate), then apply it to (1,0).
5. Find the determinant of the reflection matrix \[ \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} \] and state what it tells you.

## The Short Version

- A **transformation matrix** maps every point of a figure to a new location through a single matrix multiplication.
- The five core types are scaling, rotation, shear, reflection, and translation — each with its own matrix shape.
- Translation needs homogeneous coordinates (3×3 in 2D).
- The most common mistake is reflecting across \( y = x \) by negating coordinates instead of swapping them.
