# Mistake in alternative derivation of $\int \sec(x) \ dx$

For practice, I decided to calculate the integral of $\sec(x)$ in my own way. I did it like this:

$$\int \sec(x) \ dx$$ $$= \int \frac{dx}{\cos(x)}$$ $$= \int \frac{1}{y} \frac{dx}{dy} \ dy \ \ \ \ [y=\cos(x)]$$ $$= \int \frac{1}{y \frac{dy}{dx}} \ dy$$ $$= \int \frac{1}{y \cdot y^{\prime}} \ dy$$ $$= \int \frac{y^2 + {(y^{\prime})}^{2}}{y \cdot y^{\prime}} \ dy \ \ \ \ [1 = \cos^{2}(x)+(-\sin(x))^2]$$ $$= \int \frac{y}{y^{\prime}} \ dy \ + \int \frac{y^{\prime}}{y} \ dy$$ $$= \int y \frac{dx}{dy} \ dy \ + \ln(|y|)$$ $$= \int \cos(x) \ dx \ + \ln(\cos(x))$$ $$= \sin(x) + \ln(|\cos(x)|)+c$$ I understand that this is incorrect. But I don't understand where I made the mistake. Why is this procedure wrong?

• This is quite an interesting approach. I can't immediately see what's wrong but I'll keep looking. – Jam Aug 23 '18 at 16:17
• The mixture of $y, y'$ and $dy$ makes it a risky approach. – Yves Daoust Aug 23 '18 at 16:30
• I get $\int\frac{y'}{y}\mathrm{d}y=\int\frac{-\sin(x)\left(-\sin(x)\right)}{\cos(x)}\mathrm{d}x=-\sin(x)-\ln\left(\cos(\tfrac{x}{2})-\sin(\tfrac{x}{2})\right)+\ln\left(\cos(\tfrac{x}{2})+\sin(\tfrac{x}{2})\right)+C$ so I think splitting the integral in two might make $\int\frac{y}{y'}$ a bit easier but not $\int\frac{y'}{y}$. – Jam Aug 23 '18 at 16:38

You have $$\int\frac{y'}{y}dy$$ which you integrate as $\ln y$. This is $$\int\frac{dy/dx}{y}dy.$$ How do you get this as $\ln y$? I can see that $$\int\frac{y'}{y}dx$$ does integrate to $\ln y$, but that is not what you have.