---
# System prepended metadata

title: Calculus B Midterm

---

---
$\usepackage{mathtools}$
$\usepackage[utf8]{inputenc}$
$\usepackage{xcolor}$
---
$\newcommand{\dfdx}{\frac{\partial f}{\partial x}}
\newcommand{\defeq}{\mathrel{\colon}=}
\newcommand{\gradf}{\nabla f}
\newcommand{\fsub}[1]{f \vert_{\partial U_{#1}}}
\newcommand{\ddx}{\frac{d}{dx}}
\newcommand{\ddxx}{\frac{d^2}{dx^2}}
\newcommand{\DDx}{\dfrac{d}{dx}}
\newcommand{\vecbracket}[1]{\left\langle #1 \right\rangle}$


# Calculus B Midterm
:::success
4. Let $f \, \colon \Bbb R^2 \to \Bbb R$, $f(x,y)=\sin(xy) + \cos(xy)$.
**($\text{a}$)** [5pts] Find the directional derivative of $f$ at the point $(0,1)$ in the direction in the direction $\vec{v} = (3,4)$.
**($\text{b}$)** [5pts] What is the direction at $(0,1)$ that $f$ increases most rapidly? Express your answer by a unit vector.
**($\text{c}$)** [5pts] Find the tangent plane to the graph of $z=f(x,y)$ through $(0,1,1)$.
:::
**($\text{a}$)** The partial derivatives of $f$ are $$
\begin{cases}
f_x = y \cos(xy) - y \sin(xy) \quad &\color{red}{ \text{[1pt]} }\\
f_y = x \cos(xy) - x \sin(xy) \quad &\color{red}{ \text{[1pt]} }
\end{cases}
$$ then the gradient of $f$ at $(0,1)$ is $\gradf \vert_{(0,1)} = \vecbracket{1,0} \, .$ <font color="red">[1pt]</font>
Thus the directional derivative is 
\begin{split}
D_{\vec{v}}f\,(0,1) 
&= \gradf \vert_{(0,1)} \cdot \frac{\vec{v}}{|\vec{v}|}  \quad \color{red}{ \text{[1pt]} } \\
&= \vecbracket{1,0} \cdot \vecbracket{\frac{3}{5}, \frac{4}{5}} = \frac{3}{5} \, . \quad \color{red}{ \text{[1pt]} }
\end{split}

---
**($\text{b}$)** The gradient vector is exactly the direction with max rate of changing. <font color="red">[3pts]</font>
Thus the answer is $\vecbracket{1,0}$. <font color="red">[2pts]</font> 

---
**($\text{c}$)** The equation to the tangent plane is $$z = f_x(0,1) \cdot (x-0) + f_y(0,1) \cdot (y-1) + f(0,1) \, . \quad \color{red}{ \text{[3pt]} }$$ Thus the answer is $$z = x+1 \, . \quad \color{red}{ \text{[2pt]} }$$

:::success
5. <font color="red">[20pts]</font> Use the <font color="red">Lagrangian multiplier</font> to find the area of the largest rectangle inscribed in the ellipse $\frac{x^2}{16} + \frac{y^2}{9}=1$ with sides parallel to the coordinate axes.
:::
W.L.O.G., we can only find the vertex of the rectangle $(x,y)$ at the first quadrant, i.e. $x>0$ and $y>0$.
The object function is the area of the rectangle $f(x,y)=4xy$ or $f(x,y)=xy\,$. <font color="red">[2pts]</font>
The constraint is $\displaystyle g(x,y)=\frac{x^2}{16}+\frac{y^2}{9} \ (-1)\,$. <font color="red">[2pts]</font>
Now compute the gradient of functions $f$ and $g$, $$
\begin{cases}
\nabla f = \vecbracket{y, x} \quad \color{red}{ \text{[2pts]} } \\
\nabla g = \vecbracket{\dfrac{x}{8}, \dfrac{2y}{9}} \quad \color{red}{ \text{[2pts]} }
\end{cases}
$$ For the Lagrangian multiplier $\nabla f = \lambda \nabla g$, we need to solve the following set of equations $$
\begin{cases}
y = \lambda \dfrac{x}{8} \quad \color{red}{ \text{[2pts]} }  & (1)\\
x = \lambda \dfrac{2y}{9} \quad \color{red}{ \text{[2pts]} } & (2) \\
\dfrac{x^2}{16} + \dfrac{y^2}{9}=1 \quad \color{red}{ \text{[1pt]} } & (3)
\end{cases}
$$ Since it's meaningless if $x=0$ or $y=0$, thus we know $x \neq 0$, $y \neq 0$ and $\lambda \neq 0$. 

Now multiply the equation $(1)$ and $(2)$, we can get $\displaystyle xy = \lambda^2 \frac{2xy}{72}$, then $\lambda = \pm 6$ (choose positive) <font color="red">[2pts]</font>.

Hence we have $\displaystyle y=\frac{3}{4}x$ <font color="red">[2pts]</font>, with the equation $(3)$, we will get $\displaystyle (x,y)=(2\sqrt{2}, 3 / \sqrt{2})$. <font color="red">[2pts]</font>
Thus the largest area is $2\sqrt{2} \cdot 3 / \sqrt{2} \cdot 4 = 24$. <font color="red">[1pt]</font>

## QR Code
<img style="float: left;" src="https://i.imgur.com/4QmFo4y.png">