Your work has a valid approach, and the correct answer. However, you seem to have overlooked that the "constants of integration" are FUNCTIONS in the variables not integrated over. In this particular problem, that doesn't matter, but in other potential problems, you'll have trouble/get no answer/get confused/get wrong answers if you don't understand that. See Method #1:
is conservative if there exists some function such that .
For that to happen, the components for both must be equal, as stated in the 3 equations:
From the first equation, when you integrate, you need to remember that when taking the partial deriuvative with respect to x, you were treating y and z as constant. Thus, when you perform the indefinite integral, instead of +C, you'll have a +C(y, z), which is an arbitrary function in y and z. If you take the partial w/repect to x of the result of that integration, it might make it clearer why you needed to add an arbitrary function of y and z rather than just a constant.
Now, plug that into the 2nd equation, , getting
NOW - notice that C(y,z) has no dependence on x. Thus the LHS has no x dependence, so the RHS, which the LHS equals, also has no x dependence. But there's an x-term in the RHS. Thus the coefficient in front of that x-term in the RHS must be 0 (i.e. there actually is no x-term there). You could also see this by taking the partial derivative with respect to x of both sides (although that makes a differentiablity assumption). Either way, get:
. Therefore .
You can stop here, at . Stopping here, you haven't proven that is conservative. What you've proven is that **IF** is conservative, then the only possible value k could have is -12.
Assuming is what's called on its domain, meaning all it's 2nd order partial derivatives exist and are continuous on its domain, then
, and .
We'll only use , which means that .
So if is conservative with , and is , then using Equations 1 & 2, have:
implies that , which implies .
Again, you can stop here, at . Stopping here, you haven't proven that is conservative. What you've proven is that **IF** is conservative, and its associated is , then the only possible value k could have is -12.