OK I have to make an assumption here that you wrote this correctly.
M = 9*4*X - 12 * 9 *X + 25 * X * Y * Z + 50 I rearrange but that is how you wrote it.
Now you want dM/dX and the SOC too. Coolness can do.
First this is straight forward just do it: simplify first
M = 36X - 108X + 25 XYZ + 50 = -72X + 25XYZ + 50
SO
dM/dX = -72 + 25 YZ
d2M/dX2 = 0
I have a feeling you wrote this incorrect but as written that is what you do.