Chapter 3 Exercises and Solutions
Ten exercises, all of them worked. Try each before reading the solution — three of them (3.2, 3.5 and 3.6) are traps for a habit rather than tests of a formula, and they only teach you something if you fall into them first.
The verification code at the end of each solution is the one you should run. Every number on this page came out of it.
3.1 — Show that a formula is an inner product
Section titled “3.1 — Show that a formula is an inner product”Show that defined for all and by
is an inner product.
Solution. Read off the matrix. Every term is a product with a coefficient, and those coefficients are the entries of in :
| term | coefficient | entry |
|---|---|---|
Now check the three conditions of Definition 3.3.
Bilinear. Automatic. Any expression of the form is linear in each argument separately, because matrix multiplication is.
Symmetric. , so and .
Positive definite. Complete the square:
A sum of two squares, so it is always. It equals zero only when both squares vanish: and , hence . So it is zero only at the origin. ∎
Completing the square is the argument to give, because it needs no eigenvalue machinery — Chapter 4 has not happened yet. If you want the eigenvalue check anyway, they are and , both positive.
import numpy as np
A = np.array([[1.0, -1.0], [-1.0, 2.0]])
print("symmetric:", np.allclose(A, A.T))
print("eigenvalues:", np.round(np.linalg.eigvalsh(A), 6))
x = np.array([3.0, -2.0])
print("form on (3, -2):", float(x @ A @ x))
print("(x1 - x2)^2 + x2^2 =", (3 - (-2)) ** 2 + (-2) ** 2)symmetric: True
eigenvalues: [0.381966 2.618034]
form on (3, -2): 29.0
(x1 - x2)^2 + x2^2 = 293.2 — Is this one an inner product?
Section titled “3.2 — Is this one an inner product?”Consider with defined for all and in as
Is an inner product?
Solution. No. is not symmetric: while .
The one-line witness. Take and :
, so symmetry fails and Definition 3.3 is not satisfied. ∎
Why this exercise is here. The quadratic form is perfectly well behaved:
and only the symmetric part of affects it, , whose eigenvalues are and — both positive. So for every nonzero , and a reader who tests only positive definiteness will pass this matrix.
The failure is entirely in the asymmetry, and its consequence is concrete: “the angle between and ” would depend on which one you named first.
import numpy as np
A = np.array([[2.0, 0.0], [1.0, 2.0]])
e1, e2 = np.array([1.0, 0.0]), np.array([0.0, 1.0])
print("A =", A.tolist())
print("A^T =", A.T.tolist())
print("symmetric:", bool(np.allclose(A, A.T)))
print("<e1, e2> =", float(e1 @ A @ e2), " <e2, e1> =", float(e2 @ A @ e1))
sym = (A + A.T) / 2
print("symmetric part:", sym.tolist(), " eigenvalues:", np.round(np.linalg.eigvalsh(sym), 6))A = [[2.0, 0.0], [1.0, 2.0]]
A^T = [[2.0, 1.0], [0.0, 2.0]]
symmetric: False
<e1, e2> = 0.0 <e2, e1> = 1.0
symmetric part: [[2.0, 0.5], [0.5, 2.0]] eigenvalues: [1.5 2.5]The last line is the one to notice. The symmetric part has eigenvalues and , both positive, so for every nonzero . A verification routine that checks only positive definiteness — for instance by running Cholesky on , which is what several libraries silently do — reports this matrix as fine.
3.3 — Distance under two inner products
Section titled “3.3 — Distance under two inner products”Compute the distance between and using (a) and (b) with .
Solution. Distance is the norm of the difference (Definition 3.6), so compute the difference once:
(a) , so
(b) First , row by row:
| row | working | result |
|---|---|---|
| 1 | ||
| 2 | ||
| 3 |
Then , so
really is an inner product: its eigenvalues are exactly , and . So both answers are correct and they differ by — which is the whole point of asking for both. ∎
import numpy as np
x = np.array([1.0, 2.0, 3.0])
y = np.array([-1.0, -1.0, 0.0])
d = x - y
A = np.array([[2.0, 1.0, 0.0], [1.0, 3.0, -1.0], [0.0, -1.0, 2.0]])
print("x - y =", d)
print("A(x-y) =", A @ d)
print("(a) squared", float(d @ d), " distance", np.sqrt(float(d @ d)))
print("(b) squared", float(d @ A @ d), " distance", np.sqrt(float(d @ A @ d)))
print("A eigenvalues:", np.round(np.linalg.eigvalsh(A), 6))x - y = [2. 3. 3.]
A(x-y) = [7. 8. 3.]
(a) squared 22.0 distance 4.69041575982343
(b) squared 47.0 distance 6.855654600401044
A eigenvalues: [1. 2. 4.]3.4 — Angle under two inner products
Section titled “3.4 — Angle under two inner products”Compute the angle between and using (a) and (b) with .
Solution. Both parts use Equation 3.25, so the only work is three inner products each.
(a) Dot product.
(b) With . Compute the matrix-vector products first, and reuse them:
| quantity | working | value |
|---|---|---|
‘s eigenvalues are and , so it is a valid inner product. The two angles differ by nearly , and both are obtuse — these vectors point broadly opposite ways under either geometry, but by different amounts. ∎
import numpy as np
x = np.array([1.0, 2.0])
y = np.array([-1.0, -1.0])
B = np.array([[2.0, 1.0], [1.0, 3.0]])
for name, M in (("dot", np.eye(2)), ("B ", B)):
ip = float(x @ M @ y)
nx, ny = np.sqrt(float(x @ M @ x)), np.sqrt(float(y @ M @ y))
c = ip / (nx * ny)
print(f"({name}) <x,y> {ip:+.4f} ||x|| {nx:.6f} ||y|| {ny:.6f} "
f"cos {c:.6f} omega {np.arccos(c):.6f} rad = {np.degrees(np.arccos(c)):.6f} deg")
print("-3/sqrt(10) =", round(-3 / np.sqrt(10), 6))
print("-11/sqrt(126) =", round(-11 / np.sqrt(126), 6))
print("Bx =", B @ x, " By =", B @ y, " B eigenvalues:", np.round(np.linalg.eigvalsh(B), 6))(dot) <x,y> -3.0000 ||x|| 2.236068 ||y|| 1.414214 cos -0.948683 omega 2.819842 rad = 161.565051 deg
(B ) <x,y> -11.0000 ||x|| 4.242641 ||y|| 2.645751 cos -0.979958 omega 2.941046 rad = 168.509540 deg
-3/sqrt(10) = -0.948683
-11/sqrt(126) = -0.979958
Bx = [4. 7.] By = [-3. -4.] B eigenvalues: [1.381966 3.618034]3.5 — Projection in five dimensions
Section titled “3.5 — Projection in five dimensions”Consider the Euclidean vector space with the dot product. A subspace and are given by
\qquad \mathbf{x} = \begin{bmatrix}-1\\-9\\-1\\4\\1\end{bmatrix}$$ **(a)** Determine the orthogonal projection $\pi_U(\mathbf{x})$ of $\mathbf{x}$ onto $U$. **(b)** Determine the distance $d(\mathbf{x}, U)$.
Solution. Read the margin note in §3.8.2 first. The problem gives a spanning set, and the book warns: if is given by spanning vectors that are not a basis, determine a basis before proceeding. Here that warning has teeth.
Step 0 — the rank. Four vectors, and
One of them is redundant. Solving for it: the fourth vector is . Check the first coordinate: ✓; the second: ✓; the third: ✓; the fourth: ✓; the fifth: ✓.
So , and is a basis. Using all four columns makes singular and Equation 3.59 undefined — its condition number comes out at .
Step 1 — the normal equation on the three-column basis gives
Step 2 — the projection.
Spot-check the first coordinate: ✓. The fifth: ✓.
Step 3 — the distance.
And the check: against all four spanning vectors, not merely the three in the basis — which it must be, since the fourth lies in the span of the others. ∎
import numpy as np
U = np.array([[0.0, 1.0, -3.0, -1.0],
[-1.0, -3.0, 4.0, -3.0],
[2.0, 1.0, 1.0, 5.0],
[0.0, -1.0, 2.0, 0.0],
[2.0, 2.0, 1.0, 7.0]])
x = np.array([-1.0, -9.0, -1.0, 4.0, 1.0])
print("rank of the spanning set:", np.linalg.matrix_rank(U))
print("cond(U^T U):", f"{np.linalg.cond(U.T @ U):.3e}", "-> Eq 3.59 is undefined on all four columns")
print("column 4 in terms of the first three:",
np.round(np.linalg.lstsq(U[:, :3], U[:, 3], rcond=None)[0], 6))
B = U[:, :3] # a genuine basis
lam = np.linalg.solve(B.T @ B, B.T @ x)
proj = B @ lam
print("lambda =", np.round(lam, 10))
print("(a) pi_U(x) =", np.round(proj, 10))
print("residual =", np.round(x - proj, 10))
print("(b) distance =", round(float(np.linalg.norm(x - proj)), 6), " sqrt(60) =", round(float(np.sqrt(60)), 6))
print("orthogonal to all FOUR spanning vectors:", np.round(U.T @ (x - proj), 10))rank of the spanning set: 3
cond(U^T U): 2.018e+17 -> Eq 3.59 is undefined on all four columns
column 4 in terms of the first three: [1. 2. 1.]
lambda = [-3. 4. 1.]
(a) pi_U(x) = [ 1. -5. -1. -2. 3.]
residual = [-2. -4. 0. 6. -2.]
(b) distance = 7.745967 sqrt(60) = 7.745967
orthogonal to all FOUR spanning vectors: [ 0. 0. -0. 0.]3.6 — Projection under a non-standard inner product
Section titled “3.6 — Projection under a non-standard inner product”Consider with the inner product . Furthermore, are the standard basis in .
(a) Determine the orthogonal projection of onto . Hint: orthogonality is defined through the inner product. (b) Compute the distance . (c) Draw the scenario: standard basis vectors and .
Solution. The hint is the whole exercise. Under the dot product, is already orthogonal to , so its projection would be and the distance would be . Under this inner product it is not, because and : the coordinate axes are not perpendicular in this geometry.
(a) The normal equation with the inner product’s matrix inserted in every slot — see the last pitfall on the Orthogonal Projections page — is
Because selects rows and columns and , both sides read straight off :
The Gram matrix is diagonal, so no solving is needed:
Not the zero vector. Under this inner product has a genuine component along and along .
(b) The residual is
and the distance must be measured with the same inner product:
Compute first:
| row | working | result |
|---|---|---|
| 1 | ||
| 2 | ||
| 3 |
Then , so
Exactly . And note the trap closing: the Euclidean length of that same residual is . Using the dot product to measure a distance in a non-Euclidean geometry gives ; the correct answer is . Orthogonality was defined through the inner product, and so is length.
The orthogonality check, in the right inner product: and , both exactly.
(c) The picture: three unit coordinate arrows, the plane spanned by the first and third, and sitting in that plane at — pointing along the diagonal, not at the origin. The dashed perpendicular from down to it looks oblique in Euclidean eyes and is perpendicular in this inner product’s eyes, which is exactly what makes the exercise worth drawing. ∎
import numpy as np
A = np.array([[2.0, 1.0, 0.0], [1.0, 2.0, -1.0], [0.0, -1.0, 2.0]])
B = np.array([[1.0, 0.0], [0.0, 0.0], [0.0, 1.0]]) # columns e1 and e3
e2 = np.array([0.0, 1.0, 0.0])
G = B.T @ A @ B
c = B.T @ A @ e2
print("B^T A B =", G.tolist(), " B^T A e2 =", c)
lam = np.linalg.solve(G, c)
proj = B @ lam
r = e2 - proj
print("(a) lambda =", lam, " pi_U(e2) =", proj)
print(" A r =", A @ r)
print("(b) A-squared-norm =", float(r @ A @ r), " distance =", round(float(np.sqrt(r @ A @ r)), 6))
print(" Euclidean norm of the same residual =", round(float(np.linalg.norm(r)), 6),
" <- the WRONG answer")
print("orthogonal under A?", float(np.array([1.0, 0, 0]) @ A @ r), float(np.array([0, 0, 1.0]) @ A @ r))
print("A eigenvalues:", np.round(np.linalg.eigvalsh(A), 6))B^T A B = [[2.0, 0.0], [0.0, 2.0]] B^T A e2 = [ 1. -1.]
(a) lambda = [ 0.5 -0.5] pi_U(e2) = [ 0.5 0. -0.5]
A r = [0. 1. 0.]
(b) A-squared-norm = 1.0 distance = 1.0
Euclidean norm of the same residual = 1.224745 <- the WRONG answer
orthogonal under A? 0.0 0.0
A eigenvalues: [0.585786 2. 3.414214]3.7 — Projections, abstractly
Section titled “3.7 — Projections, abstractly”Let be a vector space and an endomorphism of .
(a) Prove that is a projection if and only if is a projection, where is the identity endomorphism on . (b) Assume now that is a projection. Calculate and as a function of and .
Solution (a). Write and expand :
So
The two differences are the same object. Hence if and only if , which is the statement in both directions at once. ∎
The one-line version: idempotence of and of are literally the same equation , rearranged.
Solution (b). Two claims.
.
: take in the image. Then , so it is in .
: take , so . Then , so is in the image. ∎
.
: if then , which exhibits as something in the image of .
: take in the image. Then . ∎
Both directions used and nothing else. So the two maps swap image and kernel:
which is why is the residual operator of §3.6: it keeps exactly what throws away, and throws away exactly what keeps. Note that nothing here assumed orthogonality — the result holds for oblique projections too, and in that case the two subspaces are complementary without being orthogonal complements.
import numpy as np
def check(P, label):
n = P.shape[0]
R = np.eye(n) - P
print(f"{label}")
print(" P^2 - P =", f"{np.linalg.norm(P @ P - P):.2e}",
" R^2 - R =", f"{np.linalg.norm(R @ R - R):.2e}")
print(" rank P =", np.linalg.matrix_rank(P), " rank R =", np.linalg.matrix_rank(R),
" sum =", np.linalg.matrix_rank(P) + np.linalg.matrix_rank(R), " n =", n)
# Im(R) = ker(P): R's columns are killed by P, and P's columns are killed by R.
print(" P @ R =", f"{np.abs(P @ R).max():.2e}", " R @ P =", f"{np.abs(R @ P).max():.2e}")
rng = np.random.default_rng(3)
B = rng.normal(size=(7, 3))
check(B @ np.linalg.inv(B.T @ B) @ B.T, "orthogonal projection onto a 3-dim subspace of R^7")
check(np.array([[1.0, 1.0], [0.0, 0.0]]), "an OBLIQUE projection (not symmetric)")orthogonal projection onto a 3-dim subspace of R^7
P^2 - P = 2.41e-16 R^2 - R = 3.11e-16
rank P = 3 rank R = 4 sum = 7 n = 7
P @ R = 1.83e-16 R @ P = 1.83e-16
an OBLIQUE projection (not symmetric)
P^2 - P = 0.00e+00 R^2 - R = 0.00e+00
rank P = 1 rank R = 1 sum = 2 n = 2
P @ R = 0.00e+00 R @ P = 0.00e+00Read the two idempotence columns together. Part (a) says and are the same expression, so exact arithmetic would give identical numbers — and the exact case, the oblique projection with integer entries, does: both print . In the floating-point case they come out at and , differing because and are formed by different sequences of operations even though they are algebraically related. Same order of magnitude, both at machine precision; the algebra is exact and the arithmetic is not.
Part (b) is the last line of each block: , so each map annihilates the other’s image — which is precisely and . And the ranks add to in both cases, including the oblique one.
3.8 — Gram-Schmidt
Section titled “3.8 — Gram-Schmidt”Using the Gram-Schmidt method, turn the basis of a two-dimensional subspace into an ONB of , where
\qquad \mathbf{b}_2 := \begin{bmatrix}-1\\2\\0\end{bmatrix}.$$
Solution.
Step 1. , kept unchanged.
Step 2. Subtract the projection of onto . The coefficient is
Check: ✓
Step 3. Normalise. , and
so the cancels and
∎
import numpy as np
b1 = np.array([1.0, 1.0, 1.0])
b2 = np.array([-1.0, 2.0, 0.0])
u1 = b1.copy()
coeff = float(u1 @ b2) / float(u1 @ u1)
u2 = b2 - coeff * u1
print("coefficient =", coeff, " (should be 1/3)")
print("u2 =", u2)
print("<u1, u2> =", float(u1 @ u2))
c1, c2 = u1 / np.linalg.norm(u1), u2 / np.linalg.norm(u2)
print("||u1|| =", np.linalg.norm(u1), " sqrt(3) =", np.sqrt(3))
print("||u2|| =", np.linalg.norm(u2), " sqrt(42)/3 =", np.sqrt(42) / 3)
print("c2 * sqrt(42) =", np.round(c2 * np.sqrt(42), 6))
C = np.stack([c1, c2], axis=1)
print("C^T C =")
print(np.round(C.T @ C, 15))coefficient = 0.3333333333333333 (should be 1/3)
u2 = [-1.33333333 1.66666667 -0.33333333]
<u1, u2> = 1.6653345369377348e-16
||u1|| = 1.7320508075688772 sqrt(3) = 1.7320508075688772
||u2|| = 2.1602468994692865 sqrt(42)/3 = 2.160246899469287
c2 * sqrt(42) = [-4. 5. -1.]
C^T C =
[[1. 0.]
[0. 1.]]3.9 — Two inequalities from Cauchy-Schwarz
Section titled “3.9 — Two inequalities from Cauchy-Schwarz”Let and let be positive real numbers so that . Use the Cauchy-Schwarz inequality and show that (a) (b) Hint: Think about the dot product on . Then, choose specific vectors and apply the Cauchy-Schwarz inequality.
Solution. Both parts are the same trick — choose the two vectors so that the inner product is the thing you know and the norms are the things you want.
(a) Take and . Then
Cauchy-Schwarz squared says , so
∎
(b) Now take and — legal because every . Then
Cauchy-Schwarz squared:
∎
When is each an equality? Cauchy-Schwarz is tight exactly when the two vectors are parallel. In (a) that means parallel to , so every equal — and with the sum fixed at , . In (b) it means proportional to , so again all equal.
Both bounds are attained at the uniform distribution and nowhere else. Which makes (a) a statement you have seen elsewhere: is minimised by the uniform distribution, so it measures concentration. It is the Simpson index, and is Gini impurity — the split criterion in a decision tree.
import numpy as np
rng = np.random.default_rng(7)
worst_a, worst_b = np.inf, np.inf
for _ in range(200000):
n = int(rng.integers(2, 9))
v = rng.random(n)
v = v / v.sum() # positive, summing to 1
worst_a = min(worst_a, float(np.sum(v ** 2) * n)) # >= 1 iff (a) holds
worst_b = min(worst_b, float(np.sum(1 / v) / n ** 2)) # >= 1 iff (b) holds
print("200000 random distributions")
print(" smallest n * sum(x^2) :", round(worst_a, 6), " (the bound is 1)")
print(" smallest sum(1/x) / n^2 :", round(worst_b, 6), " (the bound is 1)")
print()
for n in (2, 3, 5, 10):
v = np.full(n, 1.0 / n)
print(f" n={n:2} uniform: sum x^2 = {float(np.sum(v ** 2)):.6f} = 1/n = {1 / n:.6f}"
f" sum 1/x = {float(np.sum(1 / v)):.1f} = n^2 = {n ** 2}")200000 random distributions
smallest n * sum(x^2) : 1.0 (the bound is 1)
smallest sum(1/x) / n^2 : 1.0 (the bound is 1)
n= 2 uniform: sum x^2 = 0.500000 = 1/n = 0.500000 sum 1/x = 4.0 = n^2 = 4
n= 3 uniform: sum x^2 = 0.333333 = 1/n = 0.333333 sum 1/x = 9.0 = n^2 = 9
n= 5 uniform: sum x^2 = 0.200000 = 1/n = 0.200000 sum 1/x = 25.0 = n^2 = 25
n= 10 uniform: sum x^2 = 0.100000 = 1/n = 0.100000 sum 1/x = 100.0 = n^2 = 100Both minima come out at exactly over two hundred thousand samples — that is the bound being touched, and it happens because the sampler occasionally draws something very close to uniform. Neither ratio ever dips below .
3.10 — Rotate two vectors
Section titled “3.10 — Rotate two vectors”Rotate the vectors , by .
Solution. and , so by Equation 3.76
, so is minus the second column of — rotating a basis vector reads off a column, no arithmetic required.
Checks. before and after. before and after. The angle between them is before and after — nine matching digits. . ∎
import numpy as np
def rot2(theta):
c, s = np.cos(theta), np.sin(theta)
return np.array([[c, -s], [s, c]])
R = rot2(np.radians(30.0))
x1, x2 = np.array([2.0, 3.0]), np.array([0.0, -1.0])
y1, y2 = R @ x1, R @ x2
print("R(30) =", np.round(R, 6).tolist())
print("x1 ->", np.round(y1, 6), " exact:", round(np.sqrt(3) - 1.5, 6), round(1 + 1.5 * np.sqrt(3), 6))
print("x2 ->", np.round(y2, 6), " exact:", 0.5, round(-np.sqrt(3) / 2, 6))
cos = lambda a, b: float(a @ b) / (np.linalg.norm(a) * np.linalg.norm(b))
print("||x1||:", round(float(np.linalg.norm(x1)), 6), "->", round(float(np.linalg.norm(y1)), 6))
print("||x2||:", round(float(np.linalg.norm(x2)), 6), "->", round(float(np.linalg.norm(y2)), 6))
print("angle: ", round(float(np.degrees(np.arccos(np.clip(cos(x1, x2), -1, 1)))), 6),
"->", round(float(np.degrees(np.arccos(np.clip(cos(y1, y2), -1, 1)))), 6))
print("det R =", f"{np.linalg.det(R):.15f}")R(30) = [[0.866025, -0.5], [0.5, 0.866025]]
x1 -> [0.232051 3.598076] exact: 0.232051 3.598076
x2 -> [ 0.5 -0.866025] exact: 0.5 -0.866025
||x1||: 3.605551 -> 3.605551
||x2||: 1.0 -> 1.0
angle: 146.309932 -> 146.309932
det R = 1.000000000000000What the exercises were actually testing
Section titled “What the exercises were actually testing”| # | looks like it tests | actually tests |
|---|---|---|
| 3.1 | reading a formula as a matrix | that positive definiteness can be shown by completing the square, without eigenvalues |
| 3.2 | positive definiteness | symmetry — the quadratic form here is positive definite and the map is still not an inner product |
| 3.3 | two distance computations | that both answers are correct, and differ by |
| 3.4 | two angle computations | the same, for angles |
| 3.5 | the projection formula | that a spanning set is not a basis — the rank is 3, not 4, and Eq 3.59 is undefined as posed |
| 3.6 | projection onto a coordinate plane | that orthogonality and length both depend on the inner product — under the dot product the answer would be and distance ; here it is and distance , while the Euclidean length of the residual is |
| 3.7 | an abstract proof | that swaps image and kernel, for oblique projections too |
| 3.8 | Gram-Schmidt arithmetic | that the awkward thirds cancel against the norm |
| 3.9 | Cauchy-Schwarz | choosing the two vectors so the inner product is what you know |
| 3.10 | matrix-vector multiplication | that rotating reads off column |
Three of the ten (3.2, 3.5, 3.6) fail if you apply the formula without checking its preconditions. That ratio is not an accident.
-
Exercise 3.2's matrix [[2, 0], [1, 2]] fails to be an inner product. Which condition fails, and what is the shortest witness?
The quadratic form 2x1^2 + x1x2 + 2x2^2 is positive definite: only the symmetric part of A affects it, and that part has eigenvalues 1.5 and 2.5. Testing definiteness alone passes this matrix, which is the trap.
pch.quizShowAnswer
B — Symmetry; the witness is <e1, e2> = 0 against <e2, e1> = 1 — The quadratic form 2x1^2 + x1x2 + 2x2^2 is positive definite: only the symmetric part of A affects it, and that part has eigenvalues 1.5 and 2.5. Testing definiteness alone passes this matrix, which is the trap.
-
Exercise 3.5 gives four spanning vectors in R^5. What must you do first, and why?
The book flags exactly this in a margin note in section 3.8.2. np.linalg.lstsq happens to return the right projection anyway, because it uses a minimum-norm pseudo-inverse rather than an inverse — but the formula as written does not.
pch.quizShowAnswer
B — Check the rank — it is 3, so they are not a basis, B-transpose B is singular with condition number 2e17, and Equation 3.59 is undefined as posed. The fourth vector equals u1 + 2 u2 + u3 — The book flags exactly this in a margin note in section 3.8.2. np.linalg.lstsq happens to return the right projection anyway, because it uses a minimum-norm pseudo-inverse rather than an inverse — but the formula as written does not.
-
In Exercise 3.6, what is d(e2, U) and what is the tempting wrong answer?
Both wrong answers are available. Assuming orthogonality gives a projection of 0; measuring the correct residual (-0.5, 1, 0.5) with the dot product gives sqrt(1.5) = 1.224745. The correct A-norm of that residual is exactly 1.
pch.quizShowAnswer
B — Exactly 1; the wrong answer is 1.224745, from measuring the residual with the dot product instead of the exercise's inner product — Both wrong answers are available. Assuming orthogonality gives a projection of 0; measuring the correct residual (-0.5, 1, 0.5) with the dot product gives sqrt(1.5) = 1.224745. The correct A-norm of that residual is exactly 1.
-
Exercise 3.9's two bounds are attained at the same distribution. Which, and what does part (a) turn out to be?
In part (a) tightness needs x parallel to the all-ones vector, so every x-i equal, hence 1/n each. In part (b) it needs sqrt(x-i) proportional to 1 over sqrt(x-i), which again forces all equal.
pch.quizShowAnswer
B — At the uniform distribution, since Cauchy-Schwarz is tight exactly when the two vectors are parallel — and sum of x-i squared is the Simpson index, whose complement is Gini impurity — In part (a) tightness needs x parallel to the all-ones vector, so every x-i equal, hence 1/n each. In part (b) it needs sqrt(x-i) proportional to 1 over sqrt(x-i), which again forces all equal.
🧪 Try It Yourself
Section titled “🧪 Try It Yourself”Exercise A – Spot the non-inner-product
Section titled “Exercise A – Spot the non-inner-product”Exercise B – Exercise 3.5 the wrong way, then the right way
Section titled “Exercise B – Exercise 3.5 the wrong way, then the right way”Exercise C – Exercise 3.6, both answers
Section titled “Exercise C – Exercise 3.6, both answers”Exercise D – Exercise 3.7, measured
Section titled “Exercise D – Exercise 3.7, measured”Exercise E – Exercise 3.9’s equality case
Section titled “Exercise E – Exercise 3.9’s equality case”Recall card
Section titled “Recall card”- Exercise 3.2 is about symmetry, not definiteness — the quadratic form of a non-symmetric matrix can be positive definite while the map fails to be an inner product, because only the symmetric part affects the form.
- Exercise 3.5’s spanning set has rank three, not four, so the Gram matrix is singular and the projection formula is undefined as posed. Determine a basis first.
- Exercise 3.6’s coordinate axes are not perpendicular in its inner product, so the projection of the second basis vector is not zero, and the distance must be measured with the same inner product — one, not the Euclidean 1.224745.
- Exercise 3.7: the residual operator swaps image and kernel. The image of the identity minus pi is the kernel of pi and vice versa, and both idempotence conditions are the same equation.
- Exercise 3.9’s trick is choosing the vectors so that the inner product is the quantity you already know, and both bounds are tight only at the uniform distribution.
- Both distance exercises and both angle exercises give two different correct answers, which is the chapter’s central point restated as arithmetic.
Next: Chapter 3 Formula Sheet — every result on one page.
pch.coffeeTagline
pch.coffeeCtapch.feedbackHeading
pch.feedbackSubheading