where p=price of output, r=price of capital and w=price of
labour. and the constraint is Y=f(K,L). now substituting Y=f(K,L) into profite function we get Z=pf(K,L)-rK-wL. now 1st order condition for max profit (partial derivative and setting equal to zero) dz/dk= pfK-r=0