# Deriving Snell's Law from Fermat's Principle, why do we differentiate only with respect to $x$?

I'm confused about why we only differentiate with respect to the X when deriving Snell's law. Can someone explain why we do not also do a differentiation with respect to Y.