# How do you find the critical point(s) of f(x,y) = (x-y)^2?

Mar 31, 2015

The critical points of a two-variables functions are to be found using the gradient.

The gradient is a vector which has dimension equal to the number of variables: in this case, 2.

The coordinates of the gradient are the derivatives with respect to each variable the function depends on. In this case, the vector will be a 2-dimensional vector, where the first coordinate is the derivative with respect to $x$, and the second is the derivative with respect to $y$.

Note that deriving with respect to a variable means to consider the other as a constant.

Now, expand the square in the definition of $f \left(x , y\right)$ to get

${\left(x - y\right)}^{2} = {x}^{2} - 2 x y + {y}^{2}$

Deriving with respect to $x$, we get
$\frac{d}{\mathrm{dx}} f \left(x , y\right) = 2 x - 2 y = 2 \left(x - y\right)$

Deriving with respect to $y$, we get
$\frac{d}{\mathrm{dy}} f \left(x , y\right) = - 2 x + 2 y = - 2 \left(x - y\right)$

Now, critical points of a functions are the points in which the gradient equals the zero vector. This happens if the following system is solved:
$2 \left(x - y\right) = 0$
$- 2 \left(x - y\right) = 0$

Both equations yield the line $x = y$ for solutions, which means that this line is the set of the critical points for $f \left(x , y\right)$