\documentclass[a4paper]{article}

\usepackage{fancyhdr}
\usepackage{extramarks}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage[plain]{algorithm}
\usepackage{algpseudocode}
\usepackage{enumitem}
\usepackage{framed}
\usepackage{multicol}

\graphicspath{ {./images/} }

\usetikzlibrary{automata,positioning}

%
% Basic Document Settings
%

\topmargin=-0.45in
\evensidemargin=0in
\oddsidemargin=0in
\textwidth=6.5in
\textheight=9.0in
\headsep=0.25in

\linespread{1.1}

\pagestyle{fancy}
\lhead{\hmwkAuthorName}
\chead{\hmwkClass\ : \hmwkTitle}
\rhead{\firstxmark}
\lfoot{\lastxmark}
\cfoot{\thepage}

\renewcommand\headrulewidth{0.4pt}
\renewcommand\footrulewidth{0.4pt}

\setlength\parindent{0pt}

%
% Create Problem Sections
%

\newcommand{\enterProblemHeader}[1]{
    \nobreak\extramarks{}{Question \arabic{#1} continued on next page\ldots}\nobreak{}
    \nobreak\extramarks{Question \arabic{#1} (continued)}{Question \arabic{#1} continued on next page\ldots}\nobreak{}
}

\newcommand{\exitProblemHeader}[1]{
    \nobreak\extramarks{Question \arabic{#1} (continued)}{Question \arabic{#1} continued on next page\ldots}\nobreak{}
    \stepcounter{#1}
    \nobreak\extramarks{Question \arabic{#1}}{}\nobreak{}
}

\setcounter{secnumdepth}{0}
\newcounter{partCounter}
\newcounter{homeworkProblemCounter}
\setcounter{homeworkProblemCounter}{1}
\nobreak\extramarks{Question \arabic{homeworkProblemCounter}}{}\nobreak{}

\newenvironment{homeworkProblem}[1][-1]{
    \ifnum#1>0
        \setcounter{homeworkProblemCounter}{#1}
    \fi
    \section{Question \arabic{homeworkProblemCounter}}
    \setcounter{partCounter}{1}
    \enterProblemHeader{homeworkProblemCounter}
}{
    \exitProblemHeader{homeworkProblemCounter}
}

\newcommand{\hmwkClass}{INF 1004 Mathematics 2}
\newcommand{\hmwkTitle}{Tutorial\ \#11}
\newcommand{\hmwkAuthorName}{\textbf{Woon Jun Wei}}
\newcommand{\hmwkStudentID}{\textbf{2200624}}

\title{
    \vspace{2in}
    \textmd{\textbf{\hmwkClass \\ \hmwkTitle}}\\
    \vspace{3in}
}

\author{\hmwkAuthorName \\ \hmwkStudentID}
\date{\today}

\renewcommand{\part}[1]{\textbf{\large Part \arabic{partCounter}}\stepcounter{partCounter}\\}

%
% Various Helper Commands
%

% Useful for algorithms
\newcommand{\alg}[1]{\textsc{\bfseries \footnotesize #1}}

% For derivatives
\newcommand{\deriv}[1]{\frac{\mathrm{d}}{\mathrm{d}x} (#1)}

% For partial derivatives
\newcommand{\pderiv}[2]{\frac{\partial}{\partial #1} (#2)}

% Integral dx
\newcommand{\dx}{\mathrm{d}x}

% Alias for the Solution section header
\newcommand{\solution}{\textbf{\large My Solution\\}}
\newcommand{\answer}{\textbf{\large Sample Solutions\\}}

% Probability commands: Expectation, Variance, Covariance, Bias
\newcommand{\E}{\mathrm{E}}
\newcommand{\Var}{\mathrm{Var}}
\newcommand{\Cov}{\mathrm{Cov}}
\newcommand{\Bias}{\mathrm{Bias}}

\begin{document}

\maketitle

\pagebreak

\begin{homeworkProblem}
    \begin{itemize}
        \item Compute the eigenvalues and eigenvectors for the matrices below.
        \item For one of these matrices compute the matrix $P$ such that $P^{-1}DP = A$, and verify that $PAP^{-1}$ is the diagonal matrix of the eigenvalues
    \end{itemize}

    $$
    \begin{align*}
        A &= \begin{bmatrix} 4&\sqrt{15}\\\sqrt{15}&2 \end{bmatrix} \\
        A &= \begin{bmatrix} 2&-2\\-3&1 \end{bmatrix} \\
        A &= \begin{bmatrix} 2&-4\\4&-6 \end{bmatrix} \\
    \end{align*}
    $$

    \solution

\end{homeworkProblem}
\pagebreak

\begin{homeworkProblem}
    \begin{itemize}
        \item Compute an eigenvector for the eigenvalue $x = 3$ for the below $(3,3)$-matrix. Note: nobody asks you to compute its characteristic polynomial or to get all of its eigenvalues (Prof did it)
        \item Validate that the found eigenvector $v$ is indeed the correct one, that is, that $Av = 3v$ holds.
    \end{itemize}

    $$
        A = \begin{bmatrix} 1&0&1\\0&1&-2\\2&4&4 \end{bmatrix} 
    $$

    \solution

\end{homeworkProblem}
\pagebreak

\begin{homeworkProblem}
    $$
    A = \begin{bmatrix} 1&1\\0&1 \end{bmatrix}
    $$
    \begin{itemize}
        \item Show that this matrix has only the eigenvalue $1$, twice.
        \item Prove that there cannot exist any matrix P such that $P^{-1}DP = A$. Hint: You know how $D$ in $P^{-1}DP$ must look like
        \item Find an eigenvector
    \end{itemize}
    Bonus knowldge: Shear matrices have an eigenspace of dimensionality $d-1$. In the above case the set of all eigenvectors must be $cv, c \in \mathbb{R}$ for some vector $v$.\\
    \solution

\end{homeworkProblem}
\pagebreak

\begin{homeworkProblem}
    Show that $$\begin{bmatrix} 2&-4\\\frac{13}{4}&-4 \end{bmatrix}$$
    \begin{itemize}
        \item has no real eigenvalue
        \item Bonus: what are its complex-valued eigenvalues?
    \end{itemize}

    \solution

\end{homeworkProblem}
\pagebreak

\begin{homeworkProblem}
    Bonus Matrix:
    \begin{itemize}
        \item Get its eigenvalues and eigenvectors
    \end{itemize}
    Note: This is a symmetric one, so you can epect 2 eigenvalues and orthogonal eigenspace
    $$
    A = \begin{bmatrix}-2&\sqrt{24}\\\sqrt{24}&8 \end{bmatrix}
    $$

    \solution

\end{homeworkProblem}
\pagebreak

\begin{homeworkProblem}
    \begin{itemize}
        \item Use numpy to get its eigenvalues and eigenvectors
        \item Solve $Ax = (3,17,1/3)$ using numpy
        \item Not in exam:
    \end{itemize}
    Compute the characteristic polynomial for 
    $$
    A = \begin{bmatrix}1&2&4\\2&-2&1\\3&1&3 \end{bmatrix}
    $$

    \solution

\end{homeworkProblem}
\pagebreak

\begin{homeworkProblem}
    What is the cosine of the angle between
    $$(6,-6,-4,\sqrt{12}),(6,4,2,\sqrt{25})$$

    \solution

\end{homeworkProblem}
\pagebreak

\begin{homeworkProblem}
    Another 3x3 affine system
    \begin{itemize}
        \item Show the intermediate result when the first column is the one hot vector $\begin{bmatrix}1\\0\\0\end{bmatrix}$ for the first time
        \item Show the intermediate result when the matrix has row echelon form for the first time
        \item Get the solution
    \end{itemize}
    $$
    \begin{align*}
        2x-3y+2z &=-4\\
        7x+4.5y-1z &=16\\
        4x +3y+z &=2
    \end{align*}
    $$

    \solution

\end{homeworkProblem}


\end{document}
