We offer exercises on differential calculus with detailed answers. In fact, our objectives are as follows: knowing how to calculate the derivative of a function according to a vector; calculating the differential of a function at a point; and showing that a function is continuously differentiable.

We recall that differential calculus is very important in differential equations theory.

## Exercises on differential calculus

Exercise: Let $f:\mathbb{R}^2\to \mathbb{R}$ be the function defined by \begin{align*} f(x,y)=\begin{cases} \frac{x^2}{y},& y\neq 0,\cr 0,& y=0.\end{cases} \end{align*} Prove that $f$ admits directional derivatives at $(0,0)$ along all vectors $h\in\mathbb{R}^2\setminus\{(0,0)\}$ that we calculate.

Solution: Let $h=(h_1,h_2)\in\mathbb{R}^2\setminus\{(0,0)\}$. We consider the partial function \begin{align*} \varphi(t)&=f(th)=f(th_1,th_2)\cr &=\begin{cases} t f(h),& t\neq 0,\cr 0,&t=0.\end{cases} \end{align*} We remark that \begin{align*} \varphi(t)=t f(h),\qquad \forall t\in \mathbb{R}. \end{align*} This function is differential in $0$ and $\dot{\varphi}(t)=f(h)$. Hence the directional derivative at $(0,0)$ along $h$ is \begin{align*} D_hf(0,0)=f(h). \end{align*}

Exercise: Prove that the function $\mathbb{R}^2\to \mathbb{R}$ defined by \begin{align*} f(x,y)= \begin{cases} \frac{x^4+x^4}{x^2+y^2},& (x,y)\neq (0,0),\cr 0,& \text{if not.} \end{cases} \end{align*} is of class $\mathcal{C}^1$ on $\mathbb{R}^2$.

Solution: As we have a rational fraction involving $x^2+y^2$ we shall use polar coordinates to prove continuity at $(0,0)$.

Let us first prove that the partial derivatives $\frac{\partial f}{\partial x}$ and $\frac{\partial f}{\partial y}$ exist and equal to $0$ at $(0,0)$. In fact, the functions $\varphi:t\mapsto f\left((0,0)+t(1,0)\right)=t^2$ and $\psi:t\mapsto f\left((0,0)+t(0,1)\right)=t^2$ are differentiable at $0$ and $\varphi'(0)=\psi'(0)=0$. This proves the first claim.

Second, we prove continuity of partial derivatives of $f$ at $(0,0)$. Let $(x,y)\in\mathbb{R}^2\backslash\{(0,0)\}$. Then \begin{align*} \frac{\partial f}{\partial x}(x,y)=\frac{2x^5+4x^3y^2-2xy^4}{(x^2+y^2)^2}. \end{align*} For reals $r>0$ and $\theta\in\mathbb{R},$ we have \begin{align*} &\left|\frac{\partial f}{\partial x}(r\cos(\theta),r\sin(x))\right|\cr & = \left|\frac{r^5(2\cos^5(\theta)+4\cos^3(\theta)\sin^2(\theta)-2\cos(\theta)\sin^4(\theta))}{r^4}\right|\cr & \le 8r, \end{align*} which means that \begin{align*} \left|\frac{\partial f}{\partial x}(x,y)\right|\le 8\sqrt{x^2+y^2}. \end{align*} This implies that \begin{align*} \lim_{(x,y)\to (0,0)} \frac{\partial f}{\partial x}(x,y)=0. \end{align*} Hence $\frac{\partial f}{\partial x}$ is continuous at $(0,0)$. Remark that $x$ et $y$ play the same role, then we have also \begin{align*} \left|\frac{\partial f}{\partial y}(x,y)\right|\le 8\sqrt{x^2+y^2}. \end{align*} This implies that \begin{align*} \lim_{(x,y)\to (0,0)} \frac{\partial f}{\partial y}(x,y)=0. \end{align*} Hence $\frac{\partial f}{\partial y}$ is continuous at $(0,0)$. All these imply that $f$ is a class $\mathcal{C}^1$ on $\mathbb{R}^2$.

One of the classical examples in the exercises on differential calculus is the following:

Exercise: Let $E$ be an euclidian space endowed with the norm $\|x\|:=\sqrt{\langle x,x\rangle}$. Study the differentiability of the function $f(x)=\|x\|$.

Solution: We know that the function square root is differentiable at $0$, then we shall first prove that $f$ is not differentiable at $0_E$. In fact the function $t\mapsto f(th)=\|th\|=|t|\|h\|$ is not differentiable at $0$. This implies that $f$ does not admit a directional derivative along $h\in E\backslash\{0\}$ in $0$.

Assume that $x\in E\backslash\{0\}$. By using the fact that $\sqrt{1+u}=1+\frac{1}{2}u+o(u),$ as $u\to 0$, we obtain \begin{align*} \|x+h\|&=\sqrt{\langle x+h,x+h\rangle}\cr &=\sqrt{ \|x\|^2+2\langle x,h\rangle+\|h\|^2}\cr &= \|x\|\sqrt{1+\frac{2\langle x,h\rangle}{\|x\|^2}+\underset{\|h\|\to 0}{o}(\|h\|)}\cr &= \|x\|\left( 1+\frac{\langle x,h\rangle}{\|x\|^2}+\underset{\|h\|\to 0}{o}(\|h\|) \right)\cr &= \|x\|+\frac{\langle x,h\rangle}{\|x\|}+\underset{\|h\|\to 0}{o}(\|h\|) \end{align*} We define the application \begin{align*} Df(x):E\to \mathbb{R},\quad h\mapsto Df(x)h=\frac{\langle x,h\rangle}{\|x\|}. \end{align*} This application is linear and continuous since \begin{align*} |Df(x)h|\le \frac{|\langle x,h\rangle|}{\|x\|}\le \|h\|. \end{align*} We also have \begin{align*} f(x+h)=f(x)+Df(x)h+\underset{\|h\|\to 0}{o}(\|h\|). \end{align*} Thus $f$ is differentiable on $E\backslash\{0\}$ with differential application \begin{align*}Df(x):E\to \mathbb{R},\quad h\mapsto Df(x)h=\frac{\langle x,h\rangle}{\|x\|},\qquad x\neq 0. \end{align*}

You can also see details on the derivative functions.

Previous Story

Next Story