INF1004_Tutorials/Tutorial 7/INF1004_W8_Tutorial_2200624...

615 lines
19 KiB
TeX

\documentclass[a4paper]{article}
\usepackage{fancyhdr}
\usepackage{extramarks}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage[plain]{algorithm}
\usepackage{algpseudocode}
\usepackage{enumitem}
\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\ \#7}
\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}
Compute the euclidean vector norm for vectors
$$
\begin{bmatrix}
1,0,2
\end{bmatrix}
,
\begin{bmatrix}
3,4
\end{bmatrix}
,
\begin{bmatrix}
-7,2,-4, \sqrt{12}
\end{bmatrix}
$$
\solution
\part
$$\lVert [1,0,2] \rVert_2 = \sqrt{1^2 + 0^2 + 2^2} = \boxed{\sqrt{5}}$$
\part
$$\lVert [3,4] \rVert_2 = \sqrt{3^2 + 4^2} = \sqrt{25} = \boxed{5}$$
\part
$$
\begin{align*}
\lVert [-7,2,-4, \sqrt{12}] \rVert_2 &= \sqrt{(-7)^2 + 2^2 + (-4)^2 + \sqrt{12}^2} \\
&= \sqrt{49 + 4 + 16 + 12} \\
&= \sqrt{81}\\
&= \boxed{9}
\end{align*}
$$
\end{homeworkProblem}
\pagebreak
\begin{homeworkProblem}
Compute the corresponding unit length vector for these:
$$
\begin{bmatrix}
3,4
\end{bmatrix}
,
\begin{bmatrix}
-1,-2,3
\end{bmatrix}
,
\begin{bmatrix}
-7,2,-4, \sqrt{12}
\end{bmatrix}
$$
\solution
$$
\lVert v \rVert_2 = 1
$$
$$
v \neq 0 \implies \frac{v}{\lVert v \rVert_2}
$$
\part
$$
\begin{align*}
\frac{[3,4]}{\lVert [3,4] \rVert_2} &= \frac{[3,4]}{5} \\
&= \frac{1}{5} \begin{bmatrix} 3,4 \end{bmatrix} \\
&= \boxed{\begin{bmatrix} \frac{3}{5}, \frac{4}{5} \end{bmatrix}}
\end{align*}
$$
\part
$$
\begin{align*}
\frac{[-1,-2,3]}{\lVert [-1,-2,3] \rVert_2} &= \frac{[-1,-2,3]}{\sqrt{1^2 + 4^2 + 9^2}} \\
&= \frac{1}{\sqrt{14}} \begin{bmatrix} -1,-2,3 \end{bmatrix} \\
&= \boxed{\begin{bmatrix} -\frac{1}{\sqrt{14}}, -\frac{2}{\sqrt{14}}, \frac{3}{\sqrt{14}} \end{bmatrix}}
\end{align*}
$$
\part
$$
\begin{align*}
\frac{[-7,2,-4, \sqrt{12}]}{\lVert [-7,2,-4, \sqrt{12}] \rVert_2} &= \frac{[-7,2,-4, \sqrt{12}]}{\sqrt{(-7)^2 + 2^2 + (-4)^2 + \sqrt{12}^2}} \\
&= \frac{1}{\sqrt{81}} \begin{bmatrix} -7,2,-4, \sqrt{12} \end{bmatrix} \\
&= \frac{1}{9} \begin{bmatrix} -7,2,-4,\sqrt{12}\end{bmatrix}\\
&= \boxed{\begin{bmatrix} -\frac{7}{9}, \frac{2}{9}, -\frac{4}{9}, \frac{\sqrt{12}}{9} \end{bmatrix}}
\end{align*}
$$
\end{homeworkProblem}
\pagebreak
\begin{homeworkProblem}
Compute the inner product between these vectors and their angle in degrees:
$$
\begin{bmatrix}
3,-2,2
\end{bmatrix}
,
\begin{bmatrix}
1,2,2
\end{bmatrix}
$$
Compute the inner product between these vectors and their angle in degrees:
$$
\begin{bmatrix}
1,0,1
\end{bmatrix}
,
\begin{bmatrix}
2,1,-2
\end{bmatrix}
,
\begin{bmatrix}
\frac{1}{2\sqrt{2}}
, -\frac{\sqrt{3}}{2}
, \frac{1}{2\sqrt{2}}}
\end{bmatrix}
$$
\solution
$$\frac{u}{\lVert u \rVert_2} \cdot \frac{v}{\lVert v \rVert_2} = \cos(\angle (u,v))$$
\part
$$
\begin{align*}
\langle [3,-2,2], [1,2,2] \rangle &= 3 \cdot 1 + (-2) \cdot 2 + 2 \cdot 2 \\
&= 3 + (-4) + 4 \\
&= \boxed{3}
\end{align*}
$$
Angle:\\
Let $u$ be $\begin{bmatrix}3,-2,2\end{bmatrix}$ and $v$ be $\begin{bmatrix}1,2,2\end{bmatrix}$\\
$$
\begin{align*}
\cos(\angle (u,v)) &= \frac{\langle u,v \rangle}{\lVert u \rVert_2 \cdot \lVert v \rVert_2} \\
&= \frac{\begin{bmatrix}3,-2,2\end{bmatrix} \cdot \begin{bmatrix}1,2,2\end{bmatrix}}{\lVert \begin{bmatrix}3,-2,2\end{bmatrix} \rVert_2 \cdot \lVert \begin{bmatrix}1,2,2\end{bmatrix} \rVert_2} \\
&= \frac{3}{\sqrt{17}\cdot\sqrt{9}} \\
&= \frac{3}{\sqrt{153}} \\\\
\angle (u,v) &= \cos^{-1}(\frac{3}{\sqrt{153}}) \\
&= \boxed{75.96^{\circ}}
\end{align*}
$$
\pagebreak
\part
$$
\begin{align*}
\langle [1,0,1], [2,1,-2] \rangle &= 1 \cdot 2 + 0 \cdot 1 + 1 \cdot (-2) \\
&= 2 + 0 + (-2) \\
&= \boxed{0}
\end{align*}
$$
Angle:\\
Let $u$ be $\begin{bmatrix}1,0,1\end{bmatrix}$ and $v$ be $\begin{bmatrix}2,1,-2\end{bmatrix}$\\
$$
\begin{align*}
\cos(\angle (u,v)) &= \frac{\langle u,v \rangle}{\lVert u \rVert_2 \cdot \lVert v \rVert_2} \\ &= \frac{\begin{bmatrix}1,0,1\end{bmatrix} \cdot \begin{bmatrix}2,1,-2\end{bmatrix}}{\lVert \begin{bmatrix}1,0,1\end{bmatrix} \rVert_2 \cdot \lVert \begin{bmatrix}2,1,-2\end{bmatrix} \rVert_2} \\
&= \frac{0}{\sqrt{2}\cdot\sqrt{6}} \\
&= 0 \\\\
\angle (u,v) &= \cos^{-1}(0) \\
&= \boxed{90^{\circ}}
\end{align*}
$$
\part
$$
\begin{align}
[2,1,2], \left[\frac{1}{2\sqrt{2}}, -\frac{\sqrt{3}}{2}, \frac{1}{2\sqrt{2}}\right] &= \left(2 \cdot \frac{1}{2\sqrt(2)}\right) + \left(1 \cdot -\frac{\sqrt{3}}{2}\right) + \left(2 \cdot \frac{1}{2\sqrt(2)}\right) \\
&= \frac{1}{\sqrt{2}} - \frac{\sqrt{2}}{2} + \frac{1}{\sqrt{2}}\\
&= \frac{\sqrt{2}}{2}
\end{align}
$$
Angle:\\
Let $u$ be $\begin{bmatrix}2,1,2\end{bmatrix}$ and $v$ be $\begin{bmatrix}\frac{1}{2\sqrt{2}}, -\frac{\sqrt{3}}{2}, \frac{1}{2\sqrt{2}}\end{bmatrix}$\\
$$
\begin{align*}
\cos(\angle (u,v)) &= \frac{\langle u,v \rangle}{\lVert u \rVert_2 \cdot \lVert v \rVert_2} \\
&= \frac{\begin{bmatrix}2,1,2\end{bmatrix} \cdot \begin{bmatrix}\frac{1}{2\sqrt{2}}, -\frac{\sqrt{3}}{2}, \frac{1}{2\sqrt{2}}\end{bmatrix}}{\lVert \begin{bmatrix}2,1,2\end{bmatrix} \rVert_2 \cdot \lVert \begin{bmatrix}\frac{1}{2\sqrt{2}}, -\frac{\sqrt{3}}{2}, \frac{1}{2\sqrt{2}}\end{bmatrix} \rVert_2} \\
&= \frac{\frac{\sqrt{2}}{2}}{\sqrt{9}\cdot\sqrt{1}}\\
&= \frac{\frac{\sqrt{2}}{2}}{\sqrt{9}}\\
&= \frac{\sqrt{2}}{2\sqrt{9}}\\
&= \cos^{-1}(\frac{\sqrt{2}}{2\sqrt{9}})\\
&= \boxed{76.36^{\circ}}
\end{align*}
$$
\end{homeworkProblem}
\pagebreak
\begin{homeworkProblem}
\begin{itemize}
\item What is the projection of $\begin{bmatrix}5,2 \end{bmatrix}$ onto the subspace spanned by vector $\begin{bmatrix} 1,1 \end{bmatrix}$?
\item What is the projection of $\begin{bmatrix}0,2,1 \end{bmatrix}$ onto the subspace spanned by vector $\begin{bmatrix} 1,-1,-1 \end{bmatrix}$?
\item Project $\begin{bmatrix} 5,2 \end{bmatrix}$ onto the subspace spanned by vectors $\begin{bmatrix} 2,3 \end{bmatrix}$, $\begin{bmatrix}1,1 \end{bmatrix}$
\item What is the projection of $\begin{bmatrix} 1,-1,1 \end{bmatrix}$ onto the subspace spanned by vector $\begin{bmatrix} 1,1,1 \end{bmatrix}$ onto the subspace spanned by vectors $\begin{bmatrix} 0,0,-1 \end{bmatrix}, \begin{bmatrix} 2,0,1 \end{bmatrix}$? Hint: this one is more tricky. Reason: $\begin{bmatrix} 0,-1,-1 \end{bmatrix} \cdot \begin{bmatrix}2,0,1\end{bmatrix} \neq 0$
\end{itemize}
\solution
$$ x_{\parallel} v = \frac{x\cdot v}{v\cdot v}v =\left(x\cdot \frac{v}{\lVert v \rVert_2}\right) \frac{v}{\lVert v \rVert_2} $$
\part
$$
\begin{align*}
\frac{\begin{bmatrix} 5,2 \end{bmatrix} \cdot \begin{bmatrix} 1,1 \end{bmatrix}}{2} \begin{bmatrix} 1,1 \end{bmatrix} &= \frac{7}{2} \begin{bmatrix}1,1\end{bmatrix}\\
\end{align*}
$$
\part
$$
\begin{align*}
\frac{\begin{bmatrix} 0,2,1 \end{bmatrix} \cdot \begin{bmatrix} 1,-1,-1 \end{bmatrix}}{3} \begin{bmatrix} 1,-1,-1 \end{bmatrix} &= \frac{-3}{3} \begin{bmatrix}1,-1,-1\end{bmatrix}\\
&= \begin{bmatrix}-1,1,1\end{bmatrix}
\end{align*}
$$
\part
$$
\begin{align*}
\frac{\begin{bmatrix} 5,2 \end{bmatrix} \cdot \begin{bmatrix} 2,3 \end{bmatrix}}{13} \begin{bmatrix} 2,3 \end{bmatrix} + \frac{\begin{bmatrix} 5,2 \end{bmatrix} \cdot \begin{bmatrix} 1,1 \end{bmatrix}}{2} \begin{bmatrix} 1,1 \end{bmatrix} &= \frac{16}{13} \begin{bmatrix}2,3\end{bmatrix} + \frac{7}{2} \begin{bmatrix}1,1\end{bmatrix}\\
&= \begin{bmatrix} \frac{32}{13}, \frac{48}{13} \end{bmatrix} + \begin{bmatrix} \frac{7}{2}, \frac{7}{2} \end{bmatrix}\\
&= \begin{bmatrix} \frac{32+7}{13}, \frac{48+7}{13} \end{bmatrix}\\
&= \begin{bmatrix} \frac{39}{13}, \frac{55}{13} \end{bmatrix}
\end{align*}
$$
\end{homeworkProblem}
\pagebreak
\begin{homeworkProblem}
Compute these matrix multiplications:
$$
\begin{bmatrix}
2 & 1\\3&-2
\end{bmatrix}
\begin{bmatrix}
-1 &0\\-4&-2
\end{bmatrix}
$$
\\
$$
\begin{bmatrix}
-3\\2\\1
\end{bmatrix}
\begin{bmatrix}
2&4&-2
\end{bmatrix}
$$
\\
Question: Do you need more of them to practice? If so, you can do at home:\\
$$
\begin{bmatrix}
1&2\\2&4
\end{bmatrix}
\begin{bmatrix}
3&0&1\\0&1&2
\end{bmatrix}
$$
\\
$$
\begin{bmatrix}
0.5&2.5\\-3.5&1.5
\end{bmatrix}
\begin{bmatrix}
6\\4
\end{bmatrix}
$$
\solution
\part
$$
\begin{bmatrix}
2 & 1\\3&-2
\end{bmatrix}
\begin{bmatrix}
-1 &0\\-4&-2
\end{bmatrix}
=
\begin{bmatrix}
2\cdot(-1)+1\cdot(-4) & 2\cdot0+1\cdot(-2)\\3\cdot(-1)+(-2)\cdot(-4) & 3\cdot0+(-2)\cdot(-2)
\end{bmatrix}
=
\begin{bmatrix}
-6 & -2\\5 & 4
\end{bmatrix}
$$
\\
$$
\begin{bmatrix}
-3\\2\\1
\end{bmatrix}
\begin{bmatrix}
2&4&-2
\end{bmatrix}
=
\begin{bmatrix}
-3\cdot2 & -3\cdot4 & -3\cdot(-2)\\2\cdot2 & 2\cdot4 & 2\cdot(-2)\\1\cdot2 & 1\cdot4 & 1\cdot(-2)
\end{bmatrix}
=
\begin{bmatrix}
-6 & -12 & 6\\4 & 8 & -4\\2 & 4 & -2
\end{bmatrix}
$$
\part
$$
\begin{bmatrix}
1&2\\2&4
\end{bmatrix}
\begin{bmatrix}
3&0&1\\0&1&2
\end{bmatrix}
=
\begin{bmatrix}
1\cdot3+2\cdot0 & 1\cdot0+2\cdot1 & 1\cdot1+2\cdot2\\2\cdot3+4\cdot0 & 2\cdot0+4\cdot1 & 2\cdot1+4\cdot2
\end{bmatrix}
=
\begin{bmatrix}
3 & 2 & 4\\6 & 4 & 10
\end{bmatrix}
$$
\\
$$
\begin{bmatrix}
0.5&2.5\\-3.5&1.5
\end{bmatrix}
\begin{bmatrix}
6\\4
\end{bmatrix}
=
\begin{bmatrix}
0.5\cdot6+2.5\cdot4 \\ 0.5\cdot4+2.5\cdot6
\end{bmatrix}
=
\begin{bmatrix}
13 \\ -15
\end{bmatrix}
$$
\end{homeworkProblem}
\pagebreak
\begin{homeworkProblem}
\begin{itemize}
\item Project $\begin{bmatrix} 5,2 \end{bmatrix}$ onto the orthogonal space of vector $\begin{bmatrix} 2,-3 \end{bmatrix}$
\item Project $\begin{bmatrix} 1,-1,3 \end{bmatrix}$ onto the orthogonal space of vector $\begin{bmatrix} -3,1,1\end{bmatrix}$
\item Project $\begin{bmatrix} 1,-1,3,1 \end{bmatrix}$ onto the orthogonal space of vector $\begin{bmatrix} -2,2,0,0\end{bmatrix}$, $\begin{bmatrix} 0,0,\sqrt{2}, \sqrt{2}\end{bmatrix}$
\end{itemize}
\solution
\part
$$
\begin{align*}
\begin{bmatrix} 5,2 \end{bmatrix} \cdot \begin{bmatrix} 2,-3 \end{bmatrix} \cdot \frac{\begin{bmatrix} 2,-3 \end{bmatrix}}{\lVert \begin{bmatrix} 2,-3 \end{bmatrix} \rVert^2} &= \frac{2\cdot5+(-3)\cdot2}{\lVert \begin{bmatrix} 2,-3 \end{bmatrix} \rVert^2} \\
&= \frac{13}{13} \\
&= 1
\end{align*}
$$
\part
$$
\begin{align*}
\begin{bmatrix} 1,-1,3 \end{bmatrix} \cdot \begin{bmatrix} -3,1,1\end{bmatrix} \cdot \frac{\begin{bmatrix} -3,1,1\end{bmatrix}}{\lVert \begin{bmatrix} -3,1,1\end{bmatrix} \rVert^2} &= \frac{(-3)\cdot1+1\cdot(-1)+1\cdot3}{\lVert \begin{bmatrix} -3,1,1\end{bmatrix} \rVert^2} \\
&= \frac{1}{\sqrt{13}} \\
&= \frac{1}{\sqrt{13}}
\end{align*}
$$
\part
$$
\begin{align*}
\begin{bmatrix} 1,-1,3,1 \end{bmatrix} \cdot \begin{bmatrix} -2,2,0,0\end{bmatrix} \cdot \frac{\begin{bmatrix} -2,2,0,0\end{bmatrix}}{\lVert \begin{bmatrix} -2,2,0,0\end{bmatrix} \rVert^2} &= \frac{(-2)\cdot1+2\cdot(-1)+0\cdot3+0\cdot1}{\lVert \begin{bmatrix} -2,2,0,0\end{bmatrix} \rVert^2} \\
&= \frac{1}{\sqrt{8}} \\
&= \frac{1}{\sqrt{8}}
\end{align*}
$$
$$
\begin{align*}
\begin{bmatrix} 1,-1,3,1 \end{bmatrix} \cdot \begin{bmatrix} 0,0,\sqrt{2}, \sqrt{2}\end{bmatrix} \cdot \frac{\begin{bmatrix} 0,0,\sqrt{2}, \sqrt{2}\end{bmatrix}}{\lVert \begin{bmatrix} 0,0,\sqrt{2}, \sqrt{2}\end{bmatrix} \rVert^2} &= \frac{0\cdot1+0\cdot(-1)+\sqrt{2}\cdot3+\sqrt{2}\cdot1}{\lVert \begin{bmatrix} 0,0,\sqrt{2}, \sqrt{2}\end{bmatrix} \rVert^2} \\
&= \frac{3+\sqrt{2}}{\sqrt{2}} \\
&= \frac{3+\sqrt{2}}{\sqrt{2}}
\end{align*}
$$
\end{homeworkProblem}
\pagebreak
\begin{homeworkProblem}
Run Gram-Schmid-orthogonalization on the vectors
$$\begin{bmatrix} 12,12,6 \end{bmatrix}, \begin{bmatrix} 2,-2,4 \end{bmatrix}, \begin{bmatrix} -2,-2,1 \end{bmatrix}$$
\solution
\part
$$
\begin{align*}
\begin{bmatrix} 12,12,6 \end{bmatrix} &= \begin{bmatrix} 12,12,6 \end{bmatrix} \\
\begin{bmatrix} 2,-2,4 \end{bmatrix} &= \begin{bmatrix} 2,-2,4 \end{bmatrix} - \frac{2\cdot12+(-2)\cdot12+4\cdot6}{\lVert \begin{bmatrix} 12,12,6 \end{bmatrix} \rVert^2} \cdot \begin{bmatrix} 12,12,6 \end{bmatrix} \\
&= \begin{bmatrix} 2,-2,4 \end{bmatrix} - \frac{144}{144} \cdot \begin{bmatrix} 12,12,6 \end{bmatrix} \\
&= \begin{bmatrix} 2,-2,4 \end{bmatrix} - \begin{bmatrix} 12,12,6 \end{bmatrix} \\
&= \begin{bmatrix} -10,-14,-2 \end{bmatrix} \\
\begin{bmatrix} -2,-2,1 \end{bmatrix} &= \begin{bmatrix} -2,-2,1 \end{bmatrix} - \frac{(-2)\cdot12+(-2)\cdot12+1\cdot6}{\lVert \begin{bmatrix} 12,12,6 \end{bmatrix} \rVert^2} \cdot \begin{bmatrix} 12,12,6 \end{bmatrix} \\
&= \begin{bmatrix} -2,-2,1 \end{bmatrix} - \frac{0}{144} \cdot \begin{bmatrix} 12,12,6 \end{bmatrix} \\
&= \begin{bmatrix} -2,-2,1 \end{bmatrix} - \begin{bmatrix} 0,0,0 \end{bmatrix} \\
&= \begin{bmatrix} -2,-2,1 \end{bmatrix}
\end{align*}
$$
\end{homeworkProblem}
\pagebreak
\begin{homeworkProblem}
{\large \textbf{Understanding Distances coming from $\ell_p$-norms}}\\
Coding: plot in python or similar the set of points $x \in \mathbb{R}^2$ usuch that $\lVert x \rVert_p = 1$ for
\begin{itemize}
\item $p = 0.2$
\item $p = 0.5$
\item $p = 1$
\item $p = 1.5$
\item $p = 2$
\item $p = 4$
\item $p = 8$
\item $p = 16$
\end{itemize}
Hint: in 2 dimensions for $p=2$ the solution is given by
$$x(t) = \left(\cos(t), \sin(t)\right)$$
due to $\cos^2(t) + \sin^2(t) = 1$.
you can use the same idea with different powers. You can start by considering $(\cos^r(t), \sin^r(t))$. One thing to node: $\cos(t)^r + \sin(t)^r$ is not always defined for negative values and certain $r$.\\
For $p \neq 2$, you can consider this, thich deals with the signs:
$$x(t) = (sign(\cos(t))|\cos(t)|^r, sign(\sin(t))|\sin(t)|^r)$$
for the right choice of r. Find out which $r$ is suitable for a general $p > 0$ such that $\lVert x \rVert_p = 1$. Then plot it in python.\\
\solution
\part
$$
\begin{align*}
\begin{bmatrix} 1,-1,3,1 \end{bmatrix} \cdot \begin{bmatrix} 1,1,1,1\end{bmatrix} \cdot \frac{\begin{bmatrix} 1,1,1,1\end{bmatrix}}{\lVert \begin{bmatrix} 1,1,1,1\end{bmatrix} \rVert^2} &= \frac{1\cdot1+(-1)\cdot1+3\cdot1+1\cdot1}{\lVert \begin{bmatrix} 1,1,1,1\end{bmatrix} \rVert^2} \\
&= \frac{4}{2} \\
&= 2
\end{align*}
$$
\end{homeworkProblem}
\end{document}