Derivative of $\arctan(x)$: if $\tan(y) = x$, must the opposite side be $x$ and the adjacent side be $1$?

I'm reading up on the derivative of $$\arctan(x)$$, and I understand all parts of the derivation except for the geometry section on the bottom of page 2: https://ocw.mit.edu/courses/mathematics/18-01sc-single-variable-calculus-fall-2010/1.-differentiation/part-b-implicit-differentiation-and-inverse-functions/session-15-implicit-differentiation-and-inverse-functions/MIT18_01SCF10_Ses15b.pdf

I understand we have $$\tan(y) = x$$. This means the ratio of the opposite side to adjacent side must be $$x$$, and the author chose to use the values $$x$$ and $$1$$. But why can't we use $$x^2$$ and $$x$$? It preserves the ratio ($$x^2/x=x$$), but it doesn't work.

Check your calculation using $$x^2$$ and $$x$$: it should work. In this case hypotenuse is $$\sqrt{x^4+x^2}=x\sqrt{x^2+1}$$, and you can see this is simply the $$1,x,\sqrt{x^2+1}$$ triangle scaled by a factor of $$x$$, leading to the same $$\cos$$-value.
An algebraic derivation (which I like better) is as follows: since $$\tan y=x$$, $$x^2+1=\tan^2 y+1=\frac{\cos^2 y+\sin^2 y}{\cos^2 y}=\frac1{\cos^2 y}$$ so $$\cos^2 y=\frac1{x^2+1}$$. It's useful to remember $$\tan^2t+1=\sec^2t$$ where $$\sec t=\frac1{\cos t}$$.
If we use $$x^2$$ as the opposite side and $$x$$ as the adjacent side, the approach still works. In this case, the hypotenues is scaled by $$x$$ and becomes $$x\sqrt{1+x^2}$$, $$\cos y = \frac{x}{x\sqrt{1+x^2}}=\frac{1}{\sqrt{1+x^2}}$$.