Given: #(sin(pix)+cos(piy))^2 = 2#

Differentiate:

#(d((sin(pix)+cos(piy))^2))/dx = (d(2))/dx#

Use the chain rule on #(d((sin(pix)+cos(piy))^2))/dx#

The chain rule is:

#(d(g(h(x,y))))/dx = (dg)/(dh)(dh)/dx#

let #h(x,y) = sin(pix)+cos(piy)#, then:

#(dh)/dx = picos(pix) -pisin(piy)dy/dx#

#g = (h(x,y))^2#

#(dg)/(dh) = 2h(x,y)#

#(d((sin(pix)+cos(piy))^2))/dx = 2h(x,y)(picos(pix) -pisin(piy)dy/dx)#

#(d((sin(pix)+cos(piy))^2))/dx = 2(sin(pix)+cos(piy))(picos(pix) -pisin(piy)dy/dx)#

The right side is just derivative of a constant:

#(d(2))/dx = 0#

Put the terms back into the equation:

#2(sin(pix)+cos(piy))(picos(pix) -pisin(piy)dy/dx) = 0#

Solve for #dy/dx#

#-cos(pix) + sin(piy)dy/dx = 0#

#sin(piy)dy/dx = cos(pix)#

#dy/dx = cos(pix)/sin(piy)#