\documentclass{article}
\usepackage{ifxetex}
\ifxetex
\usepackage{fontspec}
\else
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\fi
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{tikz-cd}
\usepackage{mathrsfs}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage{enumitem}
\usepackage{yfonts}
\usepackage{cancel}
\title{Title of Document}
\author{Name of Author}
\newcommand{\R}{\mathbb{R}}
\begin{document}
\maketitle
As an introduction to Gr\"obner basis, we first shall find the points lying on the surface defined by $S = g^{-1}(0)$ where $g(x,y,z) = x^4 + y^2 + z^2$; which are closest to $(1,1,1)$. In other words, this problem is about minimising the distance function (which we shall denote by $f$), and to do so, we shall make use of Lagrange multipliers method. This method states that this critical points $(x_0,y_0,z_0)$, can be found by means of the following equation
$$\nabla f(x_0,y_0,z_0) = \lambda\nabla g(x_0,y_0,z_0)$$
For our function, f(x,y,z) = $\sqrt{(x-1)^2 + (y-1)^2 + (z-1)^2}$, note that this function is non-degenerate and definite positive in $\R^3$ and therefore its critical points will be minimum points. Furthermore, the minimum points of $f$ will be the same as the ones for $f^2$. Since it is easier to work with $f^2$, we will henceforth denote by $f$, $f^2$. Then the system the equations that yields
$$\left\lbrace\begin{array}{l} 2(x-1) - 4\lambda x^3 = 0 \\
2(y-1) - 2\lambda y =0 \\ 2(z-1) - 2\lambda z = 0\\ x^4 + y^2 + z^2 -1 = 0\end{array}\right.$$
\end{document}