If a surface $S$ representing the equation $z=f(x,y)$ is “smooth” near the point $P=\left(x_0,y_0,z_0\right)$, where $z_0=f(x_0,y_0)$, then it will have a tangent plane (see Fig. 1). In this section, we will derive the equation of this plane.
Later in this chapter, we will learn under which conditions the surface is smooth.
Read more about the derivation of the equation of the tangent plane
Read less
We recall that the slope of the curve formed by the intersection of $S$ and the plane $y=y_0$ at $P$ is $f_x(x_0,y_0)$. Let’s call the tangent line to the curve of of $f(x,y_0)$ at the point $P$, $L_1$.
The equation of $L_1$ is
$$zz_0=f_x(x_0,y_0)\times(xx_0)\quad\text{and}\quad y=y_0.$$

 Recall from single variable calculus that the equation of the line tangent to the curve at is Here we just need to replace by .
If $f_x(x_0,y_0)\neq 0$, we can rewrite the decription of $L_1$ in the regular format as:
$$L_1:\quad\frac{xx_0}{1}= \frac{zz_0}{f_x(x_0,y_0)},\quad\text{and}\quad y=y_0.$$
Similarly $L_2$ that is the tangent line to the intersection of $S$ and the plane $x=x_0$ at the point $P$ is described by:
$$L_2:\quad \frac{yy_0}{1}=\frac{zz_0}{f_y(x_0,y_0)}\quad\text{and}\quad x=x_0.$$
The direction vectors of the lines $L_1$ and $L_2$ are
\begin{align*}
\vec{v}_1=\left(1,0,f_x(x_0,y_0)\right),\quad \text{and}\quad \vec{v}_2=\left(0,1,f_y(x_0,y_0)\right),
\end{align*}
respectively.

 Recall that the line that is parallel to and passing through is described by . is called the direction vector of this line.
The tangent plane to the surface $S$ at the point $P$ is defined to be the plane that contains both lines $L_1$ and $L_2$. Equivalently, we can say the tangent plane contains both direction vectors $\vec{v}_1$ and $\vec{v}_2$. Therefore, the cross product of $\vec{v}_1$ and $\vec{v}_2$ is normal to the tangent plane and to the surface $S$ at the point $P$:
$$\vec{n}=\vec{v}_2\times\vec{v}_1=\begin{vmatrix}
\hat{i} & \hat{j} & \hat{k}\\
0 & 1 & f_y(x_0,y_0)\\
1 & 0 & f_x(x_0,y_0)
\end{vmatrix}=f_x(x_0,y_0)\hat{i}+f_y(x_0,y_0)\hat{j}\hat{k}$$

 Recall that if two nonparallel vectors and are in the plane , then is perpendicular to the plane and to any vector that is in .
Because the equation of a plane passing through $(x_0,y_0,z_0)$ with normal $\vec{n}=(n_1,n_2,n_3)$ is:
$$n_1(xx_0)+n_2 (yy_0)+n_3(zz_0)=0,$$
the equation of the tangent plane reads:
$$f_x(x_0,y_0)(xx_0)+f_y(x_0,y_0)(yy_0)(zz_0)=0$$
or it can be rewritten as:
$$z=z_0+f_x(x_0,y_0)(xx_0)+f_y(x_0,y_0)(yy_0)$$
 We will see later in this chapter that not only does the tangent plane contain $L_1$ and $L_2$ but also it contains the tangent line to the intersection of $S$ and any plane which is perpendicular to the $xy$plane at $(x_0,y_0,z_0)$. That’s why it is called the “tangent plane.”
\[z=z_0+f_x(x_0,y_0)(xx_0)+f_y(x_0,y_0)(yy_0),\label{TangentPlane0} \tag{*}\] where $z_0=f(x_0,y_0)$.
 If $f_x(x_0,y_0)=f_y(x_0,y_0)=0$, the tangent plane is perpendicular to the $z$axis and is given by
$$z=z_0.$$
 Because $\vec{n}=\left(f_x(x_0,y_0),f_y(x_0,y_0),1\right)$ is perpendicular to $S$ at $(x_0,y_0,z_0)$, the equation of the line normal to $S$ at the point $P$ is:
\[ \bbox[#F2F2F2,5px,border:2px solid black]{\large \frac{xx_0}{f_x(x_0,y_0)}=\frac{yy_0}{f_y(x_0,y_0)}=\frac{zz_0}{1}.}\]
If either $f_x(x_0,y_0)=0$ or $f_y(x_0,y_0)=0$, the above equation needs to be modified.