Integrating sine and cosine with respect to the triangle legs? Consider a circle centered at the origin of the $x$-$y$ plane with radius $R.$ Then: 
$$\sin \theta = \frac{y}{R}$$
But say I want to take an integral using this relationship.
$$\int\sin \theta \, d\theta$$
Substituting
$$\int \frac{y}{R} \, d\theta$$
There is no theta anymore to take the integral with respect to. Does this then become?
$$\int\frac{y}{\sqrt{x^2+y^2}} \, dy$$
But when I integrate I get
$$\sqrt{x^2+y^2} + c$$
which doesn't look like cosine of anything. What am I missing?
 A: What you're missing is that $d\theta$ is not $dy.$
One could say that $R\,d\theta = \sqrt{(dx)^2+(dy)^2\,},$ i.e. an infinitesimal increment of arc length is the square root of the sum of the squares of the corresponding infinitesimal increments of $x$ and $y.$ And since $x^2 + y^2 = R^2,$ you have $x\,dx+y\,dy = 0,$ so
$$
dx = - \frac{y\,dy} x = - \frac{y\, dy}{\sqrt{R^2-y^2}}.
$$
Thus
$$
\int \frac y R \, d\theta = \int \frac y R \sqrt{\left(\frac{y^2(dy)^2}{R^2 - y^2} \right) + (dy)^2} = \int \frac y {\sqrt{R^2-y^2}} \, dy.
$$
A: As already pointed out by Michael, you first need to take into consideration the correct increment of arc length $d\theta$, and express it as a function of the increment of the $y$-coordinate. 
Since, (CAREFUL: for $-\frac{\pi}2\leq \theta \leq \frac{\pi}2$),
$$\theta(y) = \arcsin\frac{y}{R},$$
we have, by taking derivative,
$$\frac{d\theta(y)}{dy}= \frac{R}{\sqrt{R^2-y^2}}\frac1{R}=\frac1{\sqrt{R^2-y^2}}.$$
Now you are ready to compute your integral with respect to $y$, i.e.
\begin{eqnarray}
\mathcal I &=& \int\sin \theta\ d\theta=\\
&=&\int\frac{y}{R}\frac{1}{\sqrt{R^2-y^2}}\ dy=\\
&=&-\frac{\sqrt{R^2-y^2}}{R}+C.
\end{eqnarray}
Now recall that $y = R\sin\theta$ and obtain
$$\mathcal I =-\frac{R\sqrt{1-\sin^2\theta}}{R}+C=-|\cos\theta|+C.$$
Our replacement was valid for $-\frac{\pi}2\leq \theta\leq \frac{\pi}2$, where the cosine is positive. So we have in the end
$$\mathcal I = -\cos\theta + C,$$
as expected.

As a further exercise for you, I suggest working out also the case $\frac{\pi}2\leq \theta\leq \frac{3\pi}2$.

A sidenote on your comment to Michael's answer: if you replace $R^2 = x^2+y^2$, you must take into account that $x$ is actually a function of $y$, and not a constant. So your proposed integration is not correct.
