Skip to content

Commit 71a7594

Browse files
committed
chapter1
1 parent 42192c3 commit 71a7594

File tree

1 file changed

+50
-18
lines changed

1 file changed

+50
-18
lines changed

lectures/orth_proj.md

Lines changed: 50 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -684,20 +684,57 @@ Numerical routines would in this case use the alternative form $R \hat \beta = Q
684684

685685
## Exercises
686686

687-
### Exercise 1
687+
```{exercise-start}
688+
:label: ex1
689+
```
688690

689691
Show that, for any linear subspace $S \subset \mathbb R^n$, $S \cap S^{\perp} = \{0\}$.
690692

691-
### Exercise 2
693+
```{exercise-end}
694+
```
695+
696+
```{solution-start} ex1
697+
:class: dropdown
698+
```
699+
If $x \in S$ and $x \in S^\perp$, then we have in particular
700+
that $\langle x, x \rangle = 0$, but then $x = 0$.
701+
702+
```{solution-end}
703+
```
692704

705+
```{exercise-start}
706+
:label: ex2
707+
```
693708
Let $P = X (X' X)^{-1} X'$ and let $M = I - P$. Show that
694709
$P$ and $M$ are both idempotent and symmetric. Can you give any
695710
intuition as to why they should be idempotent?
696711

697-
### Exercise 3
712+
```{exercise-end}
713+
```
714+
715+
```{solution-start} ex2
716+
:class: dropdown
717+
```
718+
719+
Symmetry and idempotence of $M$ and $P$ can be established
720+
using standard rules for matrix algebra. The intuition behind
721+
idempotence of $M$ and $P$ is that both are orthogonal
722+
projections. After a point is projected into a given subspace, applying
723+
the projection again makes no difference (A point inside the subspace
724+
is not shifted by orthogonal projection onto that space because it is
725+
already the closest point in the subspace to itself).
726+
727+
```{solution-end}
728+
```
729+
730+
731+
```{exercise-start}
732+
:label: ex3
733+
```
698734

699735
Using Gram-Schmidt orthogonalization, produce a linear projection of $y$ onto the column space of $X$ and verify this using the projection matrix $P := X (X' X)^{-1} X'$ and also using QR decomposition, where:
700736

737+
701738
$$
702739
y :=
703740
\left(
@@ -723,24 +760,14 @@ X :=
723760
\right)
724761
$$
725762

726-
## Solutions
727-
728-
### Exercise 1
729763

730-
If $x \in S$ and $x \in S^\perp$, then we have in particular
731-
that $\langle x, x \rangle = 0$, but then $x = 0$.
764+
```{exercise-end}
765+
```
732766

733-
### Exercise 2
734767

735-
Symmetry and idempotence of $M$ and $P$ can be established
736-
using standard rules for matrix algebra. The intuition behind
737-
idempotence of $M$ and $P$ is that both are orthogonal
738-
projections. After a point is projected into a given subspace, applying
739-
the projection again makes no difference. (A point inside the subspace
740-
is not shifted by orthogonal projection onto that space because it is
741-
already the closest point in the subspace to itself.).
742-
743-
### Exercise 3
768+
```{solution-start} ex3
769+
:class: dropdown
770+
```
744771

745772
Here's a function that computes the orthonormal vectors using the GS
746773
algorithm given in the lecture
@@ -832,3 +859,8 @@ Py3
832859

833860
Again, we obtain the same answer.
834861

862+
```{solution-end}
863+
```
864+
865+
866+

0 commit comments

Comments
 (0)