In the proof for Snell's law in physics, I don't understand why some variables are held constant and some not. Here's the proof:

Snell's Law - ProofWiki

They're taking the derivative of $\displaystyle T$ with respect to the length $\displaystyle x$, as labeled in the picture above. Why in particular the length $\displaystyle x$ and not e.g. the length $\displaystyle c-x$ or perhaps $\displaystyle a$? How come all the other lengths are considered parameters i.e. why are we holding them in particular constant not $\displaystyle x$ in this context? Why do we choose and consider $\displaystyle x$ to be the actual variabel?

Note: I'm doing a similar assignment where I'm to maximize the area of a triangle and I'm having a bit of a hard time deciding with respect to which variabel I'm supposed to differentiate.