I've been working on optimization problems and have been having problems with this one. The only thing that I'm confused about is what's going on when I find the derivative of the function:

Also, in case it matters,

and

, but in the example, the derivative is found with respect to the variables rather than their respective values.

My attempt:

From this point, I could do stuff like factor out a

, but it looks like mine won't be very easy to solve for zero.

This is what the derivative is supposed to be, which is easier to solve for zero:

What am I doing incorrectly?

Thanks!