From Wikipedia
In plane geometry, a shear mapping is a linear map that displaces each point in fixed direction, by an amount proportional to its signed distance from a line that is parallel to that direction.
I'm interested in the matrix representation of a general shear map in the plane. Every resource I look at either only gives the horizontal and vertical shear matrices $$\begin{bmatrix} 1 & k \\ 0 & 1\end{bmatrix} \quad\text{and}\quad \begin{bmatrix} 1 & 0 \\ k & 1\end{bmatrix}$$ or a couple have said that $$\begin{bmatrix} 1 & a \\ b & 1\end{bmatrix}$$ is also a shear map. However I don't think that last one is if neither $a$ nor $b$ is zero because, as far as I understand, shear mappings should be area preserving.
So then what is the general form of the matrix representing a shear map that displaces all vectors in the direction parallel to an arbitrary vector $(x,y)$?
$\endgroup$ 13 Answers
$\begingroup$Lets say generalized sheer takes the vector $\begin{bmatrix} x\\y\end{bmatrix}$ to $\begin{bmatrix} x\\y\end{bmatrix}$ and the orthogonal vector,
$\begin{bmatrix} -y\\x\end{bmatrix}$ to $\begin{bmatrix} -y + kx\\x + ky\end{bmatrix}$
in term of the basis$\left\{\begin{bmatrix} x\\y\end{bmatrix},\begin{bmatrix} -y\\x\end{bmatrix}\right\}$ our transformation is $T = \begin{bmatrix} 1&k\\0&1 \end{bmatrix}$
And in terms of the standard basis
$\begin{bmatrix} 1 -\frac {kxy}{x^2+y^2} & \frac {kx^2}{x^2+y^2}\\-\frac {ky^2}{x^2+y^2}&1+\frac{kxy}{x^2+y^2}\end{bmatrix}$
$\endgroup$ $\begingroup$I will illustrate the idea with a simple example. Suppose you want to shear along the $\pi/4$ direction, you need to take several steps.
- rotate $\pi/4$ clockwise: now the shearing direction is along $x$ $$ \left( \begin{array}{cc} \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \\ -\frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \\ \end{array} \right) $$
- shear with
\begin{bmatrix} 1 & k \\ 0 & 1\end{bmatrix}
- rotate $\pi/4$ conter-clockwise $$ \left( \begin{array}{cc} \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \\ \end{array} \right) $$
Say $k=1$, the combined matrix is (3rd matrix left multiply 2nd matrix left multiply 1st matrix): $$ \left( \begin{array}{cc} \frac{1}{2} & \frac{1}{2} \\ -\frac{1}{2} & \frac{3}{2} \\ \end{array} \right) $$
Apply to a unit circle
$\endgroup$ 2 $\begingroup$Let $\theta$ be the angle of the shear line from the $x$-axis. The corresponding shear matrix can be constructed by composing a basic shear with a pair of rotations: $$S=\begin{bmatrix}\cos\theta&-\sin\theta\\\sin\theta&\cos\theta\end{bmatrix}\begin{bmatrix}1&s\\0&1\end{bmatrix}\begin{bmatrix}\cos\theta&\sin\theta\\-\sin\theta&\cos\theta\end{bmatrix} = \begin{bmatrix}1-s\cos\theta\sin\theta & s\cos^2\theta \\ -s\sin^2\theta & 1+s\cos\theta\sin\theta\end{bmatrix}.$$ If the zero shear line doesn’t pass through the origin, you’ll also have to perform a pair of translations, which can’t be represented with a single matrix unless you use homogeneous coordinates.
$\endgroup$