<s>[INST] If $x^3+y^3=72$ and $xy=8$ then find the value of $x-y$. I recently came across a question,

If $x^3+y^3=72$ and $xy=8$ then find the value of $(x-y)$.

By trial and error I found that $x=4$ and $y=2$ satisfies both the conditions. But in general how can I solve it analytically? I tried using $a^3+b^3=(a+b)(a^2+b^2-ab)$ and also $a^3+b^3=(a+b)^3-3ab(a+b)$. But both ways aren't working.
Please explain how do I solve these types of questions analytically. 
 [/INST] It's two equations, with two variables. We can do what we always do. You can write $y= 8/x$, and substitute into the first equation, obtaining $x^3 + 8^3/x^3 =72.$
From here, we want to write this as a polynomial, so we multiply through $x^3$ so there are no negative powers, and then move everything to the left. This gives $x^6-72x^3+512.$ This is a pretty large polynomial, but since all the exponents are multiples of 3, all is not lost. We'll set $u=x^3$ and obtain $u^2-72u + 512$. The quadratic formula gives the factorization $(u-8)(u-64)=0,$ which of course implies that $u=8$ or that $u=64$. 
Now we just go through the substitution in $u$. We write $x^3 = 8$ or $x^3 = 64$. There is only one cube root when dealing with real numbers, so we have $x=2$ or $x=4$. If $x=2$, then we have $y=8/2=4$. If $x=4$, then we have $y=8/4=2$.
So there are two solutions then, depending on the case. Either $x-y = 2$ or $x-y=-2$ depending on which pair of solutions you work with.
</s>