Skip to content

Commit 63dc052

Browse files
authored
Merge pull request #5 from Arman-Beykmohammadi/w12_solutions
Assignment 1 and 2 solutions added to the book
2 parents 634663c + 931620a commit 63dc052

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+7143
-1609
lines changed

book/_toc.yml

Lines changed: 48 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ parts:
1313
chapters:
1414
# week 1
1515
- file: chapter_ml_basics/intro
16-
title: Machine Learning Basics
16+
title: Machine Learning Problems
1717
sections:
1818
- file: chapter_ml_basics/classification
1919
title: Classification
@@ -66,25 +66,45 @@ parts:
6666
- file: chapter_calculus/minima_first_order_condition
6767
title: First Order Condition
6868
- file: chapter_calculus/analytical_solution_ridge
69-
title: Ridge Regression
69+
title: Quadratic Optimization
7070
- file: chapter_calculus/line_search
7171
title: Line Search
7272
- file: chapter_calculus/hessian
7373
title: Hessian
74+
- file: chapter_calculus/taylors_theorem
75+
# - file: chapter_calculus/irls
76+
# title: Iteratively Re-Weighted Least Squares
7477
# study the properties of matrices
75-
# - file: chapter_decompositions/overview_decompositions # chapter_linear_algebra/linear_algebra
76-
# sections:
77-
# - file: chapter_decompositions/eigenvectors
78-
# - file: chapter_decompositions/trace_determinant
79-
# - file: chapter_decompositions/orthogonal_matrices
80-
# - file: chapter_decompositions/symmetric_matrices
81-
# - file: chapter_decompositions/psd_matrices
82-
# - file: chapter_decompositions/svd
83-
# - file: chapter_decompositions/big_picture
84-
# - file: chapter_decompositions/pseudoinverse
85-
# - file: chapter_decompositions/low_rank_approximation
86-
# - file: chapter_decompositions/matrix_norms
78+
- file: chapter_decompositions/overview_decompositions
79+
title: Matrix Analysis
80+
sections:
81+
- file: chapter_decompositions/matrix_rank
82+
- file: chapter_decompositions/determinant
83+
- file: chapter_decompositions/row_equivalence
84+
- file: chapter_decompositions/square_matrices
85+
- file: chapter_decompositions/trace
86+
- file: chapter_decompositions/eigenvectors # end week 05
87+
- file: chapter_decompositions/orthogonal_matrices
88+
- file: chapter_decompositions/symmetric_matrices
89+
- file: chapter_decompositions/Rayleigh_quotients
90+
- file: chapter_decompositions/matrix_norms
91+
- file: chapter_decompositions/psd_matrices
92+
- file: chapter_decompositions/pca # PCA as example for the eigenvalue decomposition of a psd matrix
93+
title: Principal Components Analysis
94+
- file: chapter_decompositions/svd #
95+
# - file: chapter_decompositions/RBF_kernel_Positive_Definite
96+
- file: chapter_decompositions/pseudoinverse
97+
- file: chapter_decompositions/orthogonal_projections
98+
- file: chapter_decompositions/big_picture
99+
title: Fundamental Subspaces
100+
# - file: chapter_decompositions/representer_theorem
101+
# - file: chapter_convexity/overview_convexity
102+
# title: Convexity
103+
# sections:
104+
# - file: chapter_convexity/convex_sets
105+
# - file: chapter_convexity/convex_functions
87106
# continue with second order optimization
107+
# title: Second-Order Optimization
88108
# - file: chapter_calculus/newtons_method
89109
# title: Newton's Method
90110
# - file: chapter_taylor/minima_second_order_condition
@@ -93,16 +113,13 @@ parts:
93113
# - file: chapter_calculus/orthogonal_projections
94114
# - file: chapter_taylor/overview_taylor
95115
# sections:
96-
# - file: chapter_convexity/overview_convexity
97-
# sections:
98-
# - file: chapter_convexity/convexity
99116
# - file: chapter_optimization/overview_optimization
100117
# sections:
101118
# - file: chapter_optimization/optimization
102119
# - file: chapter_optimization/optimization_second_order
103120
# - file: chapter_optimization/bfgs
104-
# - file: chapter_optimization/orthogonal_projection
105121
# - file: chapter_probability/overview_probability
122+
# title: Probability and Random Variables
106123
# sections:
107124
# - file: chapter_probability/probability_basics
108125
# - file: chapter_probability/random_variables
@@ -149,8 +166,21 @@ parts:
149166
title: First Fundamental Theorem of Calculus
150167
- file: appendix/second_fundamental_theorem_calculus
151168
title: Second Fundamental Theorem of Calculus
169+
- file: appendix/Clairauts_theorem
170+
title: Clairaut's Theorem
152171
- file: appendix/differentiation_rules
153172
title: Differentiation Rules
173+
- file: appendix/Exercise Sheet Solutions.md
174+
title: Exercise Sheet Solutions
175+
sections:
176+
- file: appendix/Exercise Sheet 1 Solutions.md
177+
title: Exercise Sheet 1 Solutions
178+
- file: appendix/Exercise Sheet 2 Solutions.md
179+
title: Exercise Sheet 2 Solutions
180+
- file: appendix/Exercise Sheet 3 Solutions.md
181+
title: Exercise Sheet 3 Solutions
182+
- file: appendix/Exercise Sheet 4 Solutions.md
183+
title: Exercise Sheet 4 Solutions
154184
# sections:
155185
# - file: appendix/proof_vector_spaces
156186
# title: Vector Spaces

book/appendix/Clairauts_theorem.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Symmetry of Mixed Partial Derivatives (Clairaut’s Theorem)
2+
3+
:::{prf:theorem} Clairaut Schwarz
4+
:label: thm-Clairaut-appendix
5+
:nonumber:
6+
7+
Let $f: \mathbb{R}^2 \to \mathbb{R}$ be a function such that both mixed partial derivatives $\frac{\partial^2 f}{\partial x \partial y}$ and $\frac{\partial^2 f}{\partial y \partial x}$ exist and are **continuous** on an open set containing a point $(x_0, y_0)$
8+
9+
Then:
10+
11+
$$
12+
\boxed{
13+
\frac{\partial^2 f}{\partial x \partial y}(x_0, y_0) = \frac{\partial^2 f}{\partial y \partial x}(x_0, y_0)
14+
}
15+
$$
16+
17+
That is, **the order of differentiation can be interchanged**.
18+
:::
19+
20+
## Intuition
21+
22+
If a function is smooth enough (specifically, if the second-order partial derivatives exist and are continuous), then the "curvature" in the $x$ direction after differentiating in the $y$ direction is the same as the curvature in the $y$ direction after differentiating in the $x$ direction.
23+
24+
---
25+
26+
## Proof Sketch
27+
28+
We will sketch a proof using the **mean value theorem** and the definition of partial derivatives. Let’s assume that $f$ has continuous second partial derivatives in an open rectangle around the point $(x_0, y_0)$.
29+
30+
Define:
31+
32+
$$
33+
F(h,k) = \frac{f(x_0 + h, y_0 + k) - f(x_0 + h, y_0) - f(x_0, y_0 + k) + f(x_0, y_0)}{hk}
34+
$$
35+
36+
Then, as $h, k \to 0$, $F(h,k) \to \frac{\partial^2 f}{\partial y \partial x}(x_0, y_0)$ and also $F(h,k) \to \frac{\partial^2 f}{\partial x \partial y}(x_0, y_0)$, provided the second partial derivatives are continuous.
37+
38+
### Step-by-step:
39+
40+
1. By the **Mean Value Theorem**, the numerator of $F(h,k)$ can be interpreted as a finite difference approximation to a mixed partial derivative.
41+
2. Using Taylor’s Theorem with remainder, or via integral representations of derivatives, one can show that:
42+
43+
$$
44+
\lim_{(h,k) \to (0,0)} F(h,k) = \frac{\partial^2 f}{\partial x \partial y}(x_0, y_0)
45+
$$
46+
47+
and also
48+
49+
$$
50+
\lim_{(h,k) \to (0,0)} F(h,k) = \frac{\partial^2 f}{\partial y \partial x}(x_0, y_0)
51+
$$
52+
53+
due to continuity of the second derivatives.
54+
3. Hence, the limits agree and the mixed partials are equal.
55+
56+
Therefore:
57+
58+
$$
59+
\frac{\partial^2 f}{\partial x \partial y}(x_0, y_0) = \frac{\partial^2 f}{\partial y \partial x}(x_0, y_0)
60+
$$
61+
62+
---
63+
64+
## When Clairaut's Theorem **Does Not Apply**
65+
66+
If the second-order mixed partial derivatives exist but are **not continuous**, the symmetry may fail. A classic counterexample is:
67+
68+
$$
69+
f(x, y) =
70+
\begin{cases}
71+
\frac{xy(x^2 - y^2)}{x^2 + y^2}, & \text{if } (x, y) \neq (0, 0) \\
72+
0, & \text{if } (x, y) = (0, 0)
73+
\end{cases}
74+
$$
75+
76+
This function has both mixed partial derivatives at the origin, but they are not equal because they are not continuous there.
77+
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Exercise Sheet 1 Solutions
2+
3+
4+
### 1.
5+
#### (a)
6+
Take any \(v_1=(a,b)\) and \(v_2=(c,d)\) in \(V\); then \(b=3a+1\) and \(d=3c+1\).
7+
Their sum is
8+
\[
9+
v_1+v_2=(a+c,\;b+d)=(a+c,\;3a+1+3c+1)=\bigl(a+c,\;3(a+c)+2\bigr),
10+
\]
11+
which **does not** satisfy \(b+d=3(a+c)+1\). Hence \(V\) is *not* closed under addition ⇒ **not a vector space**.
12+
(Equivalently, the additive identity \((0,0)\notin V\), violating axiom V1.)
13+
14+
#### (b)
15+
All axioms except **distributivity over scalar addition** fail:
16+
17+
Take \(v=(a,b)\) and scalars \(\alpha,\beta\in\mathbb R\).
18+
\[
19+
(\alpha+\beta)\,v=((\alpha+\beta)a,\;b),
20+
\quad
21+
\alpha v+\beta v=(\alpha a,\;b)+(\beta a,\;b)=((\alpha+\beta)a,\;2b).
22+
\]
23+
Unless \(b=0\), the second component differs, so
24+
\((\alpha+\beta)v\neq\alpha v+\beta v\).
25+
Therefore \(V\) is **not** a vector space.
26+
27+
28+
### 2.
29+
#### (a)
30+
*Zero vector:* \((0,0)\) satisfies \(0=2\cdot0\).
31+
*Closure (addition):* if \(y_1=2x_1\) and \(y_2=2x_2\), then
32+
\[
33+
y_1+y_2 = 2(x_1+x_2).
34+
\]
35+
*Closure (scalar mult.):* for \(\alpha\in\mathbb R\),
36+
\[
37+
\alpha(x,y)=(\alpha x,\;2\alpha x).
38+
\]
39+
All three conditions hold ⇒ \(W\) **is a subspace**.
40+
41+
#### (b)
42+
Pick \((x,y)\in W\) with \(x>0\) and any negative scalar \(\alpha<0\).
43+
Then
44+
\[
45+
\alpha(x,y)=(\alpha x,\;\alpha y),
46+
\]
47+
and \(\alpha x<0\). Thus \(\alpha(x,y)\notin W\).
48+
Not closed under scalar multiplication ⇒ **not a subspace**.
49+
50+
51+
### 3.
52+
For \(x=(a,b)\), \(y=(c,d)\) and scalars \(\alpha,\beta\):
53+
\[
54+
T(\alpha x+\beta y)=\bigl((\alpha a+\beta c)^{2},\;\alpha b+\beta d\bigr),
55+
\]
56+
\[
57+
\alpha T(x)+\beta T(y)=\bigl(\alpha^{2}a^{2}+\beta^{2}c^{2},\;\alpha b+\beta d\bigr).
58+
\]
59+
The first components differ unless \(a c=0\) or \(\alpha\beta=0\).
60+
Hence \(T\) **violates additivity/homogeneity ⇒ not linear**.

0 commit comments

Comments
 (0)