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?
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.