Example 2. Find the total differential of the function

$$
u=x^{2} \operatorname{arctg} \frac{y}{x}-y^{2} \operatorname{arctg} \frac{x}{y}
$$
Solution. The function $u$ of two variables $x$ and $y$ can be represented by the following formula:

$$
u \equiv F\left(v_{1}, v_{2}, v_{3}, v_{4}\right)=v_{1} v_{2}-v_{3} v_{4}
$$

where

$$
v_{1}=x^{2}, v_{2}=\operatorname{arctg} \frac{y}{x}, v_{3}=y^{2}, v_{4}=\operatorname{arctg} \frac{x}{y}
$$

The total differential of the function $u=f(x, y)$ is defined by the formula

$$
d u=\frac{\partial u}{\partial x} d x+\frac{\partial u}{\partial y} d y
$$

Let's find the partial derivatives $\frac{\partial u}{\partial x}$ and $\frac{\partial u}{\partial y}$ using formulas (7.20), which in this case will take the form:

$$
\left.\begin{array}{l}
\frac{\partial u}{\partial x}=\frac{\partial u}{\partial v_{1}} \cdot \frac{\partial v_{1}}{\partial x}+\frac{\partial u}{\partial v_{2}} \cdot \frac{\partial v_{2}}{\partial x}+\frac{\partial u}{\partial v_{3}} \cdot \frac{\partial v_{3}}{\partial x}+\frac{\partial u}{\partial v_{4}} \cdot \frac{\partial v_{4}}{\partial x} ; \\
\frac{\partial u}{\partial y}=\frac{\partial u}{\partial v_{1}} \cdot \frac{\partial v_{1}}{\partial y}+\frac{\partial u}{\partial v_{2}} \cdot \frac{\partial v_{2}}{\partial y}+\frac{\partial u}{\partial v_{3}} \cdot \frac{\partial v_{3}}{\partial y}+\frac{\partial u}{\partial v_{4}} \cdot \frac{\partial v_{4}}{\partial y} \cdot
\end{array}\right\}
$$

From formulas (B), we get:

$$
\begin{gathered}
\frac{\partial v_{1}}{\partial x}=2 x ; \frac{\partial v_{1}}{\partial y}=0 ; \frac{\partial v_{2}}{\partial x}=\frac{1}{1+\left(\frac{y}{x}\right)^{2}}\left(-\frac{y}{x^{2}}\right)=\frac{-y}{x^{2}+y^{2}} \\
\frac{\partial v_{2}}{\partial y}=\frac{1}{1+\left(\frac{y}{x}\right)^{2}} \cdot \frac{1}{x}=\frac{x}{x^{2}+y^{2}} ; \frac{\partial v_{3}}{\partial x}=0 ; \frac{\partial v_{3}}{\partial y}=2 y \\
\frac{\partial v_{4}}{\partial x}=\frac{1}{1+\left(\frac{x}{y}\right)^{2}} \cdot \frac{1}{y}=\frac{y}{x^{2}+y^{2}} ; \frac{\partial v_{4}}{\partial y}=\frac{1}{1+\left(\frac{x}{y}\right)^{2}} \cdot\left(-\frac{x}{y^{2}}\right)= \\
=\frac{-x}{x^{2}+y^{2}}
\end{gathered}
$$

Considering that

$$
\frac{\partial u}{\partial v_{1}}=v_{2}, \frac{\partial u}{\partial v_{2}}=v_{1}, \frac{\partial u}{\partial v_{3}}=-v_{4}, \frac{\partial u}{\partial v_{4}}=-v_{3}
$$

and substituting the obtained expressions into formulas (C), we find:

$$
\begin{aligned}
& \frac{\partial u}{\partial x}=v_{2} \cdot 2 x+v_{1} \cdot \frac{-y}{x^{2}+y^{2}}+\left(-v_{4}\right) \cdot 0+\left(-v_{3}\right) \cdot \frac{y}{x^{2}+y^{2}}= \\
& =2 x \operatorname{arctg} \frac{y}{x}-\frac{x^{2} y}{x^{2}+y^{2}}-\frac{y^{2} y}{x^{2}+y^{2}}=2 x \operatorname{arctg} \frac{y}{x}-\frac{y\left(x^{2}+y^{2}\right)}{x^{2}+y^{2}}= \\
& =2 x \operatorname{arctg} \frac{y}{x}-y ; \\
& \frac{\partial u}{\partial y}=v_{2} \cdot 0+v_{1} \cdot \frac{x}{x^{2}+y^{2}}+\left(-v_{4}\right) \cdot 2 y+\left(-v_{3}\right)\left(\frac{-x}{x^{2}+y^{2}}\right)=
\end{aligned}
$$

$$
\begin{gathered}
=\frac{x^{2} x}{x^{2}+y^{2}}-2 y \operatorname{arctg} \frac{x}{y}+\frac{x y^{2}}{x^{2}+y^{2}}=\frac{x\left(x^{2}+y^{2}\right)}{x^{2}+y^{2}}-2 y \operatorname{arctg} \frac{x}{y}= \\
=x-2 y \operatorname{arctg} \frac{x}{y}
\end{gathered}
$$

Therefore,

$$
\begin{gathered}
d u=\frac{\partial u}{\partial x} d x+\frac{\partial u}{\partial y} d y=\left(2 x \operatorname{arctg} \frac{y}{x}-y\right) d x+ \\
+\left(x-2 y \operatorname{arctg} \frac{x}{y}\right) d y
\end{gathered}
$$