Optimisation and Fermat's Last Theorem I am currently taking a course on optimisation and the lecturer has said that it is possible to pose Fermat's Last Theorem ($a^n + b^n = c^n,\ n > 2$ has no solutions in the integers) as an optimisation problem, however he said no more on it.
How exactly can this be done?
 A: I don't see how to do this in a non-silly way. However, if you really stretch the meaning of "optimization" you can sort of get it to work: asking whether FLT holds for a given $n$ is the same as asking whether the minimum value of the function $$f:(\mathbb{N}_{>0})^3\rightarrow\mathbb{N}_{\ge 0}:(a,b,c)\mapsto\vert a^n+b^n-c^n\vert$$ is positive. (My notation above is due to the fact that different texts disagree over whether $0\in\mathbb{N}$.)
Of course, this is utterly useless since we can't bring any optimization techniques to bear, the domain of $f$ not having any good geometry. Optimization problems over $\mathbb{R}$ (or similar) work pretty well since we have calculus; with a discrete domain like the natural numbers, we're out of luck in this regard. 
A: Your optimization problem is:
$$
\begin{aligned}
&\min_{x, y, z, n} (x^n + y^n - z^n)^2 \\
&\textrm{s.t.} \\
&\begin{cases}
x \geq 1 \\
y \geq 1 \\
z \geq 1 \\
n \geq 3 \\
\sin^2(x\pi) + \sin^2(y\pi) + \sin^2(z\pi) + \sin^2(n\pi) = 0
\end{cases}
\end{aligned}
$$
In case you can prove that the value of the minimum value is not $0$, then you have proved the conjecture.
Some clarifications:


*

*We square the objective function in order to discard negative values.

*$ \sin^2(x\pi) + \sin^2(y\pi) + \sin^2(z\pi) + \sin^2(n\pi) = 0$ guarantees that all 4 variables are integers. The trick is that $\sin^2$ takes values between 0 and 1, therefore the equality can be true only when all 4 components are equal to 0. For that to happen you need all 4 arguments to be multiples of $\pi$. Therefore, all 4 variables need to be integers.

