Chapter 3 · Analytic Geometry¶
End-of-chapter exercises. Each has a definitions box, explanation, worked steps, and the answer.
3.1 · Show that \(\langle\cdot,\cdot\rangle\) is an inner product¶
Topics & Definitions
- Inner product — a map \(\langle\cdot,\cdot\rangle\) taking two vectors to a number, passing three tests for all \(\mathbf{x},\mathbf{y},\mathbf{z}\) and scalars.
- Bilinear — linear in each slot separately (constants and sums pass straight through).
- Symmetric — order does not matter: \(\langle\mathbf{x},\mathbf{y}\rangle = \langle\mathbf{y},\mathbf{x}\rangle\).
- Positive definite — \(\langle\mathbf{x},\mathbf{x}\rangle > 0\) for every \(\mathbf{x}\neq\mathbf{0}\) (and \(0\) only for \(\mathbf{0}\)).
- Matrix shortcut — any \(\langle\mathbf{x},\mathbf{y}\rangle = \mathbf{x}^\top A\,\mathbf{y}\) is automatically bilinear; it is symmetric exactly when \(A = A^\top\), and positive definite exactly when \(A\) is (leading minors all positive).
The form \(\langle\mathbf{x},\mathbf{y}\rangle = x_1y_1 - (x_1y_2 + x_2y_1) + 2x_2y_2\) is a matrix form in disguise. Pulling the coefficients into a grid gives \(A = \begin{bmatrix}1&-1\\-1&2\end{bmatrix}\), so \(\langle\mathbf{x},\mathbf{y}\rangle = \mathbf{x}^\top A\,\mathbf{y}\). Because it is built as \(\mathbf{x}^\top A\mathbf{y}\) it is bilinear for free, and the two remaining checks are just facts about \(A\).
Check the three properties
Matrix form. \(\mathbf{x}^\top A\mathbf{y} = (x_1 - x_2)y_1 + (-x_1 + 2x_2)y_2 = x_1y_1 - x_1y_2 - x_2y_1 + 2x_2y_2\), matching the given form.
Symmetric. \(A = \begin{bmatrix}1&-1\\-1&2\end{bmatrix} = A^\top\), so \(\langle\mathbf{x},\mathbf{y}\rangle = \langle\mathbf{y},\mathbf{x}\rangle\).
Positive definite. Leading principal minors of \(A\): the top-left entry \(1 > 0\), and \(\det A = (1)(2) - (-1)(-1) = 1 > 0\). Both positive, so \(A\) is positive definite. Equivalently, completing the square,
which is \(0\) only when \(x_1 = x_2 = 0\).
Answer
All three properties hold, so \(\langle\cdot,\cdot\rangle\) is an inner product on \(\mathbb{R}^2\) (with matrix \(A = \begin{bmatrix}1&-1\\-1&2\end{bmatrix}\)).
3.2 · Is \(\langle\mathbf{x},\mathbf{y}\rangle = \mathbf{x}^\top A\,\mathbf{y}\) an inner product?¶
Topics & Definitions
- Symmetry is required — every inner product must satisfy \(\langle\mathbf{x},\mathbf{y}\rangle = \langle\mathbf{y},\mathbf{x}\rangle\).
- Matrix test — for \(\mathbf{x}^\top A\mathbf{y}\), symmetry holds for all vectors iff \(A = A^\top\).
- One counterexample is enough — to disprove, find a single pair where \(\langle\mathbf{x},\mathbf{y}\rangle \neq \langle\mathbf{y},\mathbf{x}\rangle\).
Here \(A = \begin{bmatrix}2&0\\1&2\end{bmatrix}\), and \(A^\top = \begin{bmatrix}2&1\\0&2\end{bmatrix} \neq A\). Since \(A\) is not symmetric, the form should fail the symmetry test, and a single well-chosen pair exposes it.
Counterexample with \(\mathbf{x} = (2,0)^\top\), \(\mathbf{y} = (0,2)^\top\)
Since \(0 \neq 4\), the form is not symmetric.
Answer
Not an inner product. With \(\mathbf{x} = (2,0)^\top,\ \mathbf{y} = (0,2)^\top\) we get \(\langle\mathbf{x},\mathbf{y}\rangle = 0\) but \(\langle\mathbf{y},\mathbf{x}\rangle = 4\), so symmetry fails (because \(A \neq A^\top\)).
3.3 · Distance between two vectors¶
Topics & Definitions
- Induced norm — an inner product gives a length: \(\lVert\mathbf{v}\rVert = \sqrt{\langle\mathbf{v},\mathbf{v}\rangle}\).
- Distance — the length of the difference vector: \(d(\mathbf{x},\mathbf{y}) = \lVert\mathbf{x}-\mathbf{y}\rVert = \sqrt{\langle\mathbf{x}-\mathbf{y},\ \mathbf{x}-\mathbf{y}\rangle}\).
- Method — subtract first to get the arrow \(\mathbf{x}-\mathbf{y}\), feed that single vector into the inner product, then square-root.
- Which inner product matters — a different inner product (a different matrix \(A\)) measures a different distance for the same two points.
Distance is just the length of the arrow joining the points. So compute \(\mathbf{x}-\mathbf{y}\) once, then take the inner product of that difference with itself and square-root it. With \(\mathbf{x} = (1,2,3)^\top\) and \(\mathbf{y} = (-1,-1,0)^\top\), the difference is \(\mathbf{x}-\mathbf{y} = (2,3,3)^\top\) for both parts; only the inner product changes.
Part a, dot product \(\langle\mathbf{x},\mathbf{y}\rangle = \mathbf{x}^\top\mathbf{y}\)
Part b, weighted product \(\langle\mathbf{x},\mathbf{y}\rangle = \mathbf{x}^\top A\mathbf{y}\)
With \(A = \begin{bmatrix}2&1&0\\1&3&-1\\0&-1&2\end{bmatrix}\) and \(\mathbf{d} = \mathbf{x}-\mathbf{y} = (2,3,3)^\top\), first apply \(A\):
Answer
a) \(d = \sqrt{22} \approx 4.69\). b) \(d = \sqrt{47} \approx 6.86\).
3.4 · Angle between two vectors¶
Topics & Definitions
- Angle formula — \(\cos\theta = \dfrac{\langle\mathbf{x},\mathbf{y}\rangle}{\lVert\mathbf{x}\rVert\,\lVert\mathbf{y}\rVert}\), then \(\theta = \arccos(\cdots)\).
- Work it in pieces — compute the inner product on top first, then each magnitude \(\lVert\mathbf{x}\rVert = \sqrt{\langle\mathbf{x},\mathbf{x}\rangle}\), then combine.
- Sign of the cosine — a negative value means an obtuse angle (more than \(90^\circ\)).
- Different inner product, different angle — swapping the dot product for \(\mathbf{x}^\top B\mathbf{y}\) reshapes what "angle" means.
Build the ratio one piece at a time: the inner product in the numerator, the two lengths in the denominator, then plug into \(\arccos\). Here \(\mathbf{x} = (1,2)^\top\) and \(\mathbf{y} = (-1,-1)^\top\).
Part a, dot product \(\langle\mathbf{x},\mathbf{y}\rangle = \mathbf{x}^\top\mathbf{y}\)
Inner product: \(\langle\mathbf{x},\mathbf{y}\rangle = (1)(-1) + (2)(-1) = -3\). Magnitudes: \(\lVert\mathbf{x}\rVert = \sqrt{1^2+2^2} = \sqrt{5}\), \(\lVert\mathbf{y}\rVert = \sqrt{(-1)^2+(-1)^2} = \sqrt{2}\). Combine:
Part b, weighted product \(\langle\mathbf{x},\mathbf{y}\rangle = \mathbf{x}^\top B\mathbf{y}\)
With \(B = \begin{bmatrix}2&1\\1&3\end{bmatrix}\), take it a piece at a time. Inner product: \(B\mathbf{y} = \begin{bmatrix}2&1\\1&3\end{bmatrix}\begin{bmatrix}-1\\-1\end{bmatrix} = \begin{bmatrix}-3\\-4\end{bmatrix}\), so \(\langle\mathbf{x},\mathbf{y}\rangle = \mathbf{x}^\top B\mathbf{y} = (1)(-3)+(2)(-4) = -11\). Magnitudes: \(\lVert\mathbf{x}\rVert_B = \sqrt{\mathbf{x}^\top B\mathbf{x}} = \sqrt{18}\), \(\lVert\mathbf{y}\rVert_B = \sqrt{\mathbf{y}^\top B\mathbf{y}} = \sqrt{7}\). Combine:
Answer
a) \(\theta \approx 161.57^\circ \approx 2.82\) rad. b) \(\theta \approx 168.51^\circ \approx 2.94\) rad.
Both angles are obtuse (negative cosine); the weighted inner product in b pushes the angle slightly wider.

3.5 · Orthogonal projection onto a subspace¶
In \(\mathbb{R}^5\) with the standard dot product, a subspace \(U\) and a vector \(x\) are given by
Find (a) the orthogonal projection \(\pi_U(x)\) and (b) the distance \(d(x,U)\).
Topics & Definitions
- Orthogonal projection onto a subspace — if the columns of \(B\) form a basis of \(U\), then \(\pi_U(x) = B(B^\top B)^{-1}B^\top x\). The coordinates \(\lambda = (B^\top B)^{-1}B^\top x\) solve the normal equations \(B^\top B\,\lambda = B^\top x\), and \(\pi_U(x) = B\lambda\).
- \(B\) needs a basis, not just a spanning set — the four given vectors are not independent, so stacking all four makes \(B^\top B\) singular (non-invertible). Trim to a genuine basis first.
- Distance to a subspace — the projection is the closest point in \(U\) to \(x\), so \(d(x,U) = \lVert x - \pi_U(x)\rVert\). The residual \(x-\pi_U(x)\) is orthogonal to every basis vector, a handy way to check.
The four spanning vectors are not linearly independent, so the first job is to trim them to a real basis. Then build \(B\) from those basis vectors, solve the normal equations for the coordinates \(\lambda\), and assemble the projection. The distance is just the length of what is left over.
Step 1, trim the spanning set to a basis (RREF)
Stack the four spanning vectors as columns of \(A\) and row-reduce to find the pivot columns:
Pivots sit in columns 1, 2, 3, so those three vectors form a basis of \(U\). Column 4 is dependent: reading off the last RREF column, \(v_4 = v_1 + 2v_2 + v_3\).
Pitfall
Take the basis vectors from the original matrix \(A\), never from the RREF. Row reduction only identifies which columns are independent; it changes the columns themselves.
Step 2, build \(B\) and compute \(B^\top B\)
Each entry is a dot product of two columns of \(B\); the matrix is symmetric, so only six of the nine entries need computing.
Step 3, solve the normal equations for \(\lambda\)
The coordinates come out as clean integers, a good sign the arithmetic is right.
Step 4, projection and distance
The residual is
which is orthogonal to each basis vector (dotting with \(v_1\): \(0 + 4 + 0 + 0 - 4 = 0\)). Its length is the distance:
Answer

3.6 · Projection under a non-standard inner product¶
In \(\mathbb{R}^3\) with the inner product
let \(e_1,e_2,e_3\) be the standard basis and \(U = \operatorname{span}[e_1,e_3]\). Find (a) \(\pi_U(e_2)\), (b) \(d(e_2,U)\), and (c) a sketch of the scenario.
Topics & Definitions
- Projection under a general inner product — when \(\langle x,y\rangle = x^\top A y\) for a symmetric positive-definite \(A\), every inner-product slot gains an \(A\): \(\pi_U(x) = B(B^\top A B)^{-1}B^\top A\,x\). The standard dot product is just the case \(A = I\).
- Reading inner products off \(A\) — since \(A_{ij} = \langle e_i,e_j\rangle\), here \(\langle e_1,e_2\rangle = 1\) and \(\langle e_2,e_3\rangle = -1\), so under this metric \(e_2\) is not orthogonal to the plane \(U\), which is exactly why the projection is nonzero.
- Distance with the same inner product — \(d(e_2,U) = \sqrt{\langle r,r\rangle} = \sqrt{r^\top A r}\) with \(r = e_2 - \pi_U(e_2)\). A valid inner product always gives \(\langle r,r\rangle \ge 0\); a negative value signals a slip.
Anywhere two vectors would normally be dotted, sandwich the matrix \(A\) between them. Everything else (build \(B\), solve for \(\lambda\), assemble the projection, measure the leftover) runs exactly like the standard case.
Step 1, set up \(B\), then \(B^\top A B\) and \(B^\top A e_2\)
The basis of \(U\) is \(e_1,e_3\), so \(B = \begin{pmatrix}1&0\\0&0\\0&1\end{pmatrix}\). Then
(\(A e_2\) is simply the second column of \(A\): \((1,2,-1)^\top\).)
Step 2, solve for \(\lambda\) and form the projection
Step 3, distance under the weighted norm
The residual is \(r = e_2 - \pi_U(e_2) = \left(-\tfrac12,\ 1,\ \tfrac12\right)^\top\). Measure its length with the same inner product, not the plain norm:
so \(d(e_2,U) = \sqrt{1} = 1\).
Common mistake
Using the plain norm \(\sqrt{r^\top r} = \sqrt{3/2}\) here is wrong. Once the problem defines a weighted inner product, every length, angle, and orthogonality check uses that same inner product.
Answer
Part c, the geometry
The plane \(U = \operatorname{span}(e_1,e_3)\) is the floor; \(e_1\) and \(e_3\) lie in it and \(e_2\) stands above the origin. Under the standard dot product \(e_2\) is perpendicular to \(U\), so its projection would be the origin. Under this weighted inner product \(e_2\) leans toward \(e_1\) (\(\langle e_1,e_2\rangle = +1\)) and away from \(e_3\) (\(\langle e_2,e_3\rangle = -1\)), so the projection lands at \(\left(\tfrac12,0,-\tfrac12\right)\): a diagonal in the plane, close to \(e_1\) but pulled slightly toward \(-e_3\). The dashed residual connects \(e_2\) to \(\pi_U(e_2)\) and its length is the distance \(d = 1\).

3.7 · Projections and their complements¶
Let \(V\) be a vector space and \(\pi\) an endomorphism of \(V\).
(a) Prove that \(\pi\) is a projection if and only if \(\operatorname{id}_V - \pi\) is a projection, where \(\operatorname{id}_V\) is the identity endomorphism on \(V\).
(b) Assuming \(\pi\) is a projection, compute \(\operatorname{Im}(\operatorname{id}_V - \pi)\) and \(\ker(\operatorname{id}_V - \pi)\) in terms of \(\operatorname{Im}(\pi)\) and \(\ker(\pi)\).
Topics & Definitions
- Projection \(=\) idempotent — an endomorphism \(\pi\) is a projection exactly when \(\pi^2 = \pi\). Once you have landed in the target subspace, projecting again does not move you. This single equation drives the whole exercise.
- The identity behaves like \(1\) — composing with \(\operatorname{id}_V\) changes nothing: \(\operatorname{id}\circ\pi = \pi\) and \(\pi\circ\operatorname{id} = \pi\). This is what lets \((\operatorname{id} - \pi)^2\) expand exactly like ordinary algebra.
- What \(\operatorname{id} - \pi\) does — feed it \(v\) and you get \(v - \pi(v)\): the vector minus its projection, the same residual used to compute distances in the earlier exercises.
- Proving a set equality — to show \(A = B\), prove both inclusions \(A \subseteq B\) and \(B \subseteq A\).
Part a is pure algebra: expand \((\operatorname{id} - \pi)^2\) and watch the condition \(\pi^2 = \pi\) appear. Part b then chases elements through \(\operatorname{id} - \pi\), using \(\pi^2 = \pi\) where needed, to show the image and kernel simply swap.
Part a, expand \((\operatorname{id} - \pi)^2\)
Write \(\operatorname{id}\) for \(\operatorname{id}_V\). Expanding the composition:
The two middle terms each collapse to \(\pi\), since composing with the identity does nothing.
Part a, chain of equivalences
\(\operatorname{id} - \pi\) is a projection precisely when it is idempotent:
Every step is reversible (subtract \(\operatorname{id}\), then add \(2\pi\), to both sides), so the biconditional holds in both directions at once. \(\blacksquare\)
Why both directions come free
Because the chain uses \(\iff\) rather than \(\implies\), reading it top-to-bottom proves one direction and bottom-to-top proves the other. No separate argument is needed.
Part b, \(\ker(\operatorname{id} - \pi) = \operatorname{Im}(\pi)\)
Work directly from the definition of the kernel:
The statement \(v = \pi(v)\) says that \(v\) is an output of \(\pi\), which is exactly what it means for \(v\) to lie in \(\operatorname{Im}(\pi)\). Every step is an equivalence, so
Note this direction does not even require idempotency.
Part b, \(\operatorname{Im}(\operatorname{id} - \pi) = \ker(\pi)\)
(\(\subseteq\)) Let \(w \in \operatorname{Im}(\operatorname{id} - \pi)\), so \(w = v - \pi(v)\) for some \(v\). Apply \(\pi\):
using \(\pi^2 = \pi\). So \(w \in \ker(\pi)\).
(\(\supseteq\)) Let \(w \in \ker(\pi)\), so \(\pi(w) = 0\). Then
so \(w\) is its own image under \(\operatorname{id} - \pi\), hence \(w \in \operatorname{Im}(\operatorname{id}-\pi)\).
Both inclusions hold, so \(\operatorname{Im}(\operatorname{id}-\pi) = \ker(\pi)\). \(\blacksquare\)
Answer
a) \(\pi\) is a projection \(\iff \pi^2 = \pi \iff (\operatorname{id}_V - \pi)^2 = \operatorname{id}_V - \pi \iff \operatorname{id}_V - \pi\) is a projection.
b) The image and kernel swap:
Intuition. A projection splits the space as \(V = \operatorname{Im}(\pi) \oplus \ker(\pi)\), acting as the identity on the first part and as zero on the second. The complementary map \(\operatorname{id}_V - \pi\) keeps the residual instead, so it kills exactly what \(\pi\) keeps and keeps exactly what \(\pi\) kills. Their images and kernels therefore trade places.
3.8 · Gram-Schmidt orthonormalisation¶
Using the Gram-Schmidt method, turn the basis \(B = (b_1, b_2)\) of a two-dimensional subspace \(U \subseteq \mathbb{R}^3\) into an orthonormal basis (ONB) \(C = (c_1, c_2)\) of \(U\), where
Topics & Definitions
- Gram-Schmidt — turns any basis into an orthonormal one, one vector at a time. The engine is the projection machinery: for each new vector, subtract off its projection onto everything already built, then normalise what is left.
- Orthogonal set — build \(u_1, u_2, \dots\) by \(u_1 = v_1\) and \(u_k = v_k - \sum_{j<k} \dfrac{\langle v_k, u_j\rangle}{\lVert u_j\rVert^2}\, u_j\). Each subtracted term removes the component of \(v_k\) lying along a previous \(u_j\), leaving a residual orthogonal to all of them.
- Normalise last — once orthogonal, scale to unit length: \(c_k = \dfrac{u_k}{\lVert u_k\rVert}\).
It is cleanest to orthogonalise first (get \(u_1, u_2\)), then normalise at the very end. Normalising as you go also works, but carrying square roots through the subtraction step is much messier by hand.
Step 1, first vector
Take \(u_1 = b_1 = (1,1,1)^\top\), with \(\lVert u_1\rVert = \sqrt{3}\). Normalising:
Step 2, subtract the projection from \(b_2\)
The projection coefficient of \(b_2\) onto \(u_1\):
Subtract that component off:
Simplification
Scaling a vector does not change its direction, so \(u_2\) can be rescaled to the clean integer vector \((-4, 5, -1)^\top\) before normalising. Same unit vector, far less fraction wrangling.
Step 3, normalise \(u_2\)
Step 4, verify
Answer
Equivalently, with denominators rationalised,
Both forms are correct; the factored form is usually cleaner to read.

Reference: Gram-Schmidt Process (Professor Dave Explains)
3.9 · Cauchy-Schwarz with cleverly chosen vectors¶
Let \(n \in \mathbb{N}\) and let \(x_1, \dots, x_n > 0\) be positive reals with \(x_1 + \dots + x_n = 1\). Use the Cauchy-Schwarz inequality to show that
(a) \(\displaystyle\sum_{i=1}^n x_i^2 \geq \frac{1}{n}\), (b) \(\displaystyle\sum_{i=1}^n \frac{1}{x_i} \geq n^2\).
Topics & Definitions
- Cauchy-Schwarz — for any vectors \(u, v\) in an inner product space, \(\langle u, v\rangle^2 \leq \lVert u\rVert^2 \cdot \lVert v\rVert^2\), with equality exactly when \(u\) and \(v\) are linearly dependent.
- The trick here — the question is about sums of numbers, not vectors, so none are given. The whole skill is inventing vectors \(u\) and \(v\) whose Cauchy-Schwarz inequality happens to say the thing you want.
- How to find them — Cauchy-Schwarz has three slots (\(\langle u,v\rangle^2\), \(\lVert u\rVert^2\), \(\lVert v\rVert^2\)). You have two ingredients to place: the target (what you are bounding) and the constraint (\(\sum x_i = 1\)). Decide which slot each goes in, then solve for the vector components.
- Where the square roots come from — a squared norm squares every component before adding, so to get \(\lVert v\rVert^2 = \sum \tfrac{1}{x_i}\) you solve \((v_i)^2 = \tfrac1{x_i}\), giving \(v_i = \tfrac{1}{\sqrt{x_i}}\). The root is just what survives the squaring, and \(x_i > 0\) is what makes it well-defined.
Both parts follow the same recipe: put the target in a norm slot, choosing the components so squaring reproduces it, place the constraint wherever it lands, then let the last slot fall out. Part a needs no roots because its target is already a sum of squares; part b needs them.
Part a, choose the vectors
The target \(\sum x_i^2\) is already a sum of squares, so it drops straight into a norm slot with no roots:
The constraint \(\sum x_i = 1\) is a plain sum, so it belongs in the dot product. Solving \(u \cdot v = \sum x_i\) term by term forces \(v_i = 1\):
Part a, apply the inequality
Dividing by \(n\) (positive, so the direction is preserved):
Part b, choose the vectors
Nothing in Cauchy-Schwarz manufactures reciprocals, so they must be built into a vector from the start. For the target, solve \((v_i)^2 = \tfrac{1}{x_i}\):
For the constraint, solve \((u_i)^2 = x_i\):
Part b, apply the inequality
Both vectors are now fixed, and the reciprocal pairing cancels inside the dot product:
Substituting into Cauchy-Schwarz:
Answer
The pattern. In both parts: put the target in a norm slot (solving for components so squaring produces it), put the constraint wherever it fits, and let the remaining slot fall out. Part a needs no square roots because its target is already a sum of squares; part b needs them because neither the target nor the constraint is.
Both bounds are tight. Equality in Cauchy-Schwarz needs \(u\) and \(v\) parallel, which here means all the \(x_i\) are equal, i.e. \(x_i = \tfrac1n\). Substituting confirms both bounds are hit exactly there.
3.10 · Rotating vectors in the plane¶
Rotate the vectors
by \(30^\circ\).
Topics & Definitions
- Rotation matrix — in \(\mathbb{R}^2\), an anticlockwise rotation by angle \(\theta\) about the origin is the linear map \(R(\theta) = \begin{pmatrix}\cos\theta & -\sin\theta\\\sin\theta & \cos\theta\end{pmatrix}\), and rotating is just \(x \mapsto R(\theta)\,x\).
- Where it comes from — the columns are the images of the standard basis vectors. Rotating \(e_1 = (1,0)^\top\) lands it at \((\cos\theta, \sin\theta)^\top\) (column 1); rotating \(e_2 = (0,1)^\top\) lands it at \((-\sin\theta, \cos\theta)^\top\) (column 2).
- Sign convention — positive \(\theta\) is anticlockwise. For clockwise, use \(R(-\theta)\), which flips the signs of the two sine terms.
- Rotations are orthogonal maps — \(R(\theta)^\top R(\theta) = I\), so they preserve lengths and angles: \(\lVert R(\theta)x\rVert = \lVert x\rVert\). That gives a free check on any answer.
A rotation just spins each vector about the origin without stretching it. Write down \(R(30^\circ)\) once, multiply each vector through, and then confirm the lengths are unchanged as a sanity check.
Step 1, write down \(R(30^\circ)\)
With \(\cos 30^\circ = \tfrac{\sqrt3}{2}\) and \(\sin 30^\circ = \tfrac12\):
Keep the surds
Work with exact values \(\tfrac{\sqrt3}{2}\) and \(\tfrac12\) rather than decimals. Rounding early accumulates error and hides the structure of the answer.
Step 2, rotate \(x_1\)
Step 3, rotate \(x_2\)
A nice cross-check: \(x_2\) starts pointing straight down, at \(270^\circ\). Rotating anticlockwise by \(30^\circ\) lands it at \(300^\circ\), and indeed \((\cos 300^\circ, \sin 300^\circ) = (\tfrac12, -\tfrac{\sqrt3}{2})\).
Step 4, verify lengths are preserved
Rotations are isometries, so the norms must be unchanged:
If a rotated vector has a different length from the original, there is an arithmetic error somewhere.
Answer

Spotted a mistake or a step that doesn't make sense? Open an issue and I'll fix it.
Finding these useful? A star on GitHub helps other learners find them.