%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ai-learning-template.tex: a latex template for Prince's book
% version: 0.2 (2019-05-22)
% compile: pdflatex or latex/platex + dvipdfmx from TexLive
% note: customize the notation for normal distribution by \N
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%
% English class
%
\documentclass{article} % for pdflatex
%\documentclass[dvipdfmx]{article} % for latex
%
% Japanese class
%
% \documentclass[dvipdfmx]{jsarticle}

%
% packages
%
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{url}
\usepackage{mathrsfs}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{bm}

%
% page style
% notice (by Nakagawa sensei): units need "true" modifier to work with jsarticle
%
\textwidth = 16truecm
\textheight = 21truecm
\oddsidemargin = 0truecm
\pagestyle{fancy}
\chead{Answers to Prince's \textit{Computer Vision}}

%
% macro
%

% Prince's notation of normal distribution
\newcommand{\N}[3]{{\mathtt{Norm}_{#1}(#2, #3)}}
% Other notation of normal distribution
% \newcommand{\N}[3]{{\mathcal{N}({#1}: #2, #3)}}

%--------------------------------------------------------------
\begin{document}


\bf{Problem 4.3 (Wenruo Lyu, 2019/05/09)}

$$ L = \sum_{k=1}^6 N_k \log [\lambda_k] + \nu (\sum_{k=1}^6 \lambda_k - 1) \eqno{(4.29)}$$

$$ \frac{\partial L}{\partial \lambda_k} = N_k \cdot \frac{1}{\lambda_k} + \nu = 0   \Longrightarrow   \lambda_k = - \frac{N_k}{\nu} \eqno{(1)}$$

$$ \frac{\partial L}{\partial \nu} = \sum_{k=1}^6 \lambda_k - 1 = 0   \Longrightarrow   \sum_{k=1}^6 \lambda_k = 1 \eqno{(2)}$$

by (1) and (2) we can get

$$ \sum_{m=1}^6 \lambda_m = \sum_{m=1}^6(- \frac{N_m}{\nu}) = - \frac{1}{\nu} \sum_{m=1}^6 N_m = 1$$

$$ \Longrightarrow \nu = - \sum_{m=1}^6 N_m$$
$$ \therefore \hat{\lambda_k} = - \frac{N_k}{\nu} = \frac{N_k}{\sum_{m=1}^6 N_m}$$

\newpage

The notation for normal distribution can be customized by command $\backslash N$.

\bigskip
\begin{tabular}{cc}
Univariate & $\N{x}{\mu}{\sigma^2}$ \\
Multivariate & $\N{\mathbf{x}}{\bm{\mu}}{\bm{\Sigma}}$
\end{tabular}

\end{document}
