Given X+Y+Z = 0, find $\frac{(X^3+Y^3+Z^3)}{XYZ}$ The result can be found using the equation :
$(X^3+Y^3+Z^3) - 3XYZ = (X+Y+Z)(X^2 - XY +Y^2 - YZ +Z^2 - XZ)$
Since X+Y+Z = 0, the right side of the equation is equal to 0. Therefore $X^3+Y^3+Z^3 = 3XYZ$ and the answer to the problem is 3.
However what if we calculate $X^3+Y^3+Z^3$ as $(X+Y+Z)^3 - 3X^2Y - 3Y^2X - 3X^2Z - 3z^2X - 3Y^2Z - 3Z^2Y$. $(X+Y+Z)^3 = 0$, so $X^3+Y^3+Z^3$ can be replaced with $- 3X^2Y - 3Y^2X - 3X^2Z - 3Z^2X - 3Y^2Z - 3Z^2Y$.
$\frac{- 3X^2Y - 3Y^2X - 3X^2Z - 3Z^2X - 3Y^2Z - 3Z^2Y}{XYZ}$ = $\frac{-3X - 3Y}{Z} - \frac{-3X-3Z}{Y} - \frac{-3Y-3Z}{X}$
If X+Y+Z = 0, consequenty 3X+3Y+3Z = 0. Our expression can be rewritten as $\frac{-3Z}{Z} + \frac{-3Y}{Y} +\frac{-3X}{X}$, so the answer is -9.
Could you please tell me which way of solving this problem is right and why
 A: In your second set of calculations, where you're subtracting terms from $(X + Y + Z)^3$, you're missing a $-6XYZ$ term. Also, going from $3X + 3Y + 3Z = 0$ gives $-3X - 3Y = 3Z$, not $-3Z$, with this sign error occurring for the other $2$ terms as well. When you include the $-6XYZ$ term, you'll get an additional $\frac{-6XYZ}{XYZ} = -6$ value, and correcting for the second mistake with the term sign values, it becomes $9$ instead of $-9$.
Thus, the end result becomes $9 - 6 = 3$, as you got originally. As such, both methods give the same end result, as expected.
A: The first attempt is correct, assuming that $X, Y, Z \neq 0$. You can verify this with a simple example, say $X = Y = 1, Z = -2$. The mistake in the second attempt is due to the fact that you have missed a term in your expression of $X^3 + Y^3 + Z^3$. Specifically,
$$(X + Y + Z)^3 = X^3 + Y^3 + Z^3 + 3(X^2 Y + Y^2 X + X^2 Z + Z^2 X + Y^2 Z + Z^2 Y) + \color{blue}{6XYZ}$$
To avoid errors like the one you made, always check that the number of terms in your expansion is correct! We expect $3^3 = 27$ terms in the expansion of $(X + Y + Z)^3$, and your expansion only gave $21$. You can then plug this into your second method and you will see that you get the correct answer of $3$.
