-
Notifications
You must be signed in to change notification settings - Fork 0
/
modelsolutions.tex
127 lines (118 loc) · 3.62 KB
/
modelsolutions.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
\documentclass[10pt,a4paper]{amsart}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[finnish]{babel}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{calc}
\def\viiva #1 #2 {\mathop{\Big/}\limits_{\!\!\!{#1}}^{\>\,{#2}}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
\setlength{\parindent}{0pt}
\newenvironment{tehtratk}%
{\begin{list}{\arabic{enumi}.}{\usecounter{enumi}%
\setlength{\labelsep}{0.5em}%
\settowidth{\labelwidth}{\arabic{enumi}.}%
\setlength{\leftmargin}{\labelwidth+\labelsep}}}%
{\end{list}}
\begin{document}
\textbf{Natural Image and Video Statistics\\
Homework for Chapter 4\\
Model solutions (Jussi Martin)}
\vspace{1cm}
\begin{tehtratk}
\item[\textbf{1.}] Math exercise 1 from chapter 4.\\
\\
\textbf{Solution:} If we write the conditional probability as
\[ p(z_2|z_1 = a) =
\frac{p_{\mathbf{z}}(a, z_2)}{\int p_{\mathbf{z}}(a, z_2)dz_2}\]
we see that integration over $z_2$ gives us
\[ \int p(z_2|z_1 = a)dz_2 =
\int \frac{p_{\mathbf{z}}(a, z_2)}{\int p_{\mathbf{z}}(a, z_2)dz_2}dz_2 =
\frac{\int p_{\mathbf{z}}(a, z_2)dz_2}{\int p_{\mathbf{z}}(a, z_2)dz_2} = 1\]
since the denominator is just a constant.
\vspace{0.3cm}
\item[\textbf{2.}] Math exercise 2 from chapter 4.\\
\\
\textbf{Solution:} Lets denote the random variable by $z$ (in the sequel I will
denote also its values by $z$). Since it is distributed uniformly on the
interval $[a, b]$ we have
\[
p(z) = \frac{1}{b - a} \quad \text{for every $z$ in $[a, b]$}.
\]
Its mean is
\[
E\{z\} = \int_a^b p(z)zdz = \frac{1}{b - a}\int_a^b zdz =
\frac{1}{b - a}\Big(\frac{b^2}{2} - \frac{b^2}{2}\Big).
\]
Since
\[
b^2 - a^2 = (b + a)(b - a)
\]
we get
\[
E\{z\} =
\frac{1}{2}\frac{(b + a)(b - a)}{b - a} = \frac{b + a}{2}.
\]
Its variance is
\[
\text{var}(z) = E\{z^2\} - (E\{z\})^2 = \int_a^b p(z)z^2dz - (E\{z\})^2.
\]
Using the previous result for the mean we get
\[
\text{var}(z) = \int_a^b p(z)z^2dz - \frac{(b + a)^2}{4} =
\frac{1}{b - a}\int_a^b z^2dz - \frac{(b + a)^2}{4}.
\]
Solving the integral we get
\[
\text{var}(z) =
\frac{1}{b - a}\Big(\frac{b^3}{3} - \frac{a^3}{3}\Big)- \frac{(b + a)^2}{4}
\]
and since
\[
b^3 - a^3 = (b -a)(b^2 + ab + a^2)
\]
we see that
\[
\text{var}(z) = \frac{(b^2 + ab + a^2)}{3} - \frac{(b + a)^2}{4}
= \frac{4b^2 + 4ab + 4a^2}{12} -\frac{3b^2 + 6ab + 3b^2}{12}.\]
Which reducies to:
\[
\text{var}(z) = \frac{b^2 - 2ab - a^2}{12} = \frac{(b - a)}{12}^2.
\]
\vspace{0.3cm}
\item[\textbf{3.}] Math exercise 6 from chapter 4.\\
\\
\textbf{Solution:} Now the likelihood is
\[
p(z(1), \ldots , z(n)|\alpha) =
\frac{1}{\sqrt{2 \pi}}\exp(-\frac{1}{2}\sum_{i = 0}^n(z(i) - \alpha)^2)
\]
and the log-likelihood is
\[
\log p(z(1), \ldots , z(n)|\alpha) =
-\frac{1}{2}\sum_{i = 0}^n(z(i) - \alpha)^2 - \text{const.}
\]
Since the logarithm is an incresing function, the value which maximizes the
log-likelihood also maximizes the likelihood. Furthermore, the log-likelihood
function is a down opening parabola and hence the maximum is achieved in the
unique point $\hat{\alpha}$ on top of the parabola. This point is also the point
where derivative of the function
\[f(\alpha) = -\frac{1}{2}\sum_{i = 0}^n(z(i) - \alpha)^2\]
is zero.
The maximum value of the likelihood is thus found by setting
$f'(\hat{\alpha}) = 0$, which yields:
\[
\big(-\sum_{i = 0}^n z(i)\big) + n\hat{\alpha} = 0
\quad \Leftrightarrow \quad \hat{\alpha} = \frac{1}{n}\sum_{i = 0}^n z(i),
\]
since
\[
\frac{d}{d\alpha}(z(i) - \alpha)^2 = -2(z(i) -\alpha) \ \text{for every $i$.}
\]
\end{tehtratk}
\end{document}