The a8 = -1 is because a8 is the coefficient of z, and your original equation is f(x,y) = z while your plotting function's equation is f(x,y,z) = 0, so we need to subtract z from both sides of the original to get the equations to match up. That gives f(x,y) - z = 0, so the coefficient of z is...