Homework Assignment 1

Homework Assignment 1#

All answers must be well-reasoned. An answer without reasoning does not give any points.

  1. It is a good idea to make your answer to the assignment directly as a Jupyter Notebook. You can download the ipynb file directly from this page. Here you can see the markdown syntax and e.g. how to write mathematical expressions.

  2. Your answer to the assignment must be delivered as a PDF file. If you experience issues with the export from Jupyter Notebook to PDF, then contact the DTU Python Support.

Problem 1#

Consider a quadratic form \(q:\mathbb{R}^3 \to \mathbb{R}\) with the expression:

\[\begin{equation*} q(x_1 , x_2 , x_3)=x_1^2 +7x_2^2 +7x_3^2 +8x_1 x_2 -8x_1 x_3 +4x_2 x_3+x_1 -2x_2 +3. \end{equation*}\]

a) Provide an orthonormal basis with usual orientation for \(\mathbb{R}^3\) in which the quadratic form is reduced (meaning without mixed product terms). An orthonormal basis with usual orientation is an orthonormal basis \(\beta = \pmb{u}_1, \pmb{u}_2, \pmb{u}_3\) in \(\mathbb{R}^3\) for which \(U = [\pmb{u}_1, \pmb{u}_2, \pmb{u}_3]\) has a determinant of \(1\).

b) State an expression for \(q\) with respect to this new basis.

c) Justify that \(q\) can take values that are both arbitrarily large and arbitrarily small. (In other words, you must show that the image/range is not bounded - neither upwards nor downwards.)

Problem 2#

Consider a function \(f:\mathbb{R}^2 \to \mathbb{R}\) with the expression:

\[\begin{equation*} f(x_1 ,x_2 )= \sin(x_1^2 +x_2 )+x_1 -x_2+3. \end{equation*}\]

a) Create a plot in SymPy that contains level curves and the gradient at the point \((x_1, x_2)=(-2,1)\).

b) Use your plot to determine whether the function is increasing or decreasing at the point \((x_1, x_2)=(-2,1)\) in the direction defined by the \(x_1\) axis (meaning, in the positive \(x_1\) direction).

c) Repeat questions a) and b), but this time for the point \((x_1, x_2)=(2,-1)\).

Problem 3#

We consider two functions \(\pmb{f}:\mathbb{R}^4 \to \mathbb{R}^3\) and \(g:\mathbb{R}^3 \to \mathbb{R}\).

We are being informed that \(\pmb{f}\) has the expression:

\[\begin{equation*} \pmb{f}(x_1, x_2, x_3, x_4)=(x_2 x_3+x_1^2,-x_1 x_4 + x_2^3,x_1 x_2 x_3 x_4). \end{equation*}\]

We are furthermore informed that the Jacobian matrix \(\pmb{J}_g \in \mathbb{R}^{1 \times 3}\) of \(g\) is given by:

\[\begin{equation*} \pmb{J}_g (y_1,y_2,y_3)=\begin{bmatrix} 1+y_3+2y_1 y_2 & y_1^2+2y_2 y_3^2-3 & 3+y_1+2y_3 y_2^2 \end{bmatrix}. \end{equation*}\]

a) Determine the Jacobian matrix \(\pmb{J}_{\pmb{f}}(1,-2,-1,4)\) of the function \(\pmb{f}\) at the point \((x_1, x_2, x_3, x_4,)=(1,-2,-1,4)\).

b) We now consider the composite map \(g \circ \pmb{f}\). State the Jacobian matrix of this map at the point \((x_1, x_2, x_3, x_4,)=(1,-2,-1,4)\).

Problem 4#

Write a Python program that as its input takes a vector \(\pmb{v} \in \mathbb{C}^4\) (which is not the zero vector) and as its output gives an orthonormal basis for \(\mathbb{C}^4\) in which the first basis vector has the same direction as \(\pmb{v}\). Two vectors \(\pmb{v}\) and \(\pmb{u}\) in \(\mathbb{C}^n\) are said to have the same direction if a scalar \(c\geq0\) exists such that \(\pmb{v} = c \pmb{u}\).

Problem 5#

Consider a function \(f:\mathbb{R} \to \mathbb{R}\) with the expression:

\[\begin{equation*} f(x)=(ReLU(x))^2. \end{equation*}\]

a) Justify that \(f\) is differentiable on the entire real axis, and provide an expression for the differential quotient \(f'\).

b) Is \(f'\) differentiable on the entire real axis?

c) Is \(f'\) continuous on the entire real axis?