Originally Posted by

**malaygoel** I have just completed the cube.

You would have sometimes completed the square.

$\displaystyle (a+b)^2 = a^2 + b^2 +2ab$

If you an expression, $\displaystyle ax^2 + bx + c$ and you want to find in what conditions it is a perfect square, we would do some adjustments and express it as $\displaystyle a(x + \frac{b}{2a})^2 + \frac{4ac-b^2}{4a}.$

For it to be a perfect square, $\displaystyle b^2 = 4ac$ and $\displaystyle a$ should be a perfect square.

I have done exactly the same thing, I have compared S with $\displaystyle (a+b)^3$ and equated the term $\displaystyle -6zk^2$ with $\displaystyle 3ab(a+b)(a=z,b=z-k)$.