Solve $\frac{dy}{dx}=\frac{y^2-1}{x^2-1}$ with initial condition $y(2)=2$

If $\dfrac{\mathrm dy}{\mathrm dx}=\dfrac{u(y)}{u(x)}$ for some function $u$ then $\dfrac{\mathrm dy}{u(y)}=\dfrac{\mathrm dx}{u(x)}$ hence $\displaystyle\int_{y(a)}^{y(x)}\frac{\mathrm dt}{u(t)}=\int_{a}^{x}\frac{\mathrm dt}{u(t)}$. If $y(a)=a$ this shows that $y(x)=x$ for every $x$ such that $u(t)\ne0$ for every $t$ from $a$ to $x$.

If $a=2$ and $u(t)=t^2-1$, this shows that $y(x)=x$ for every $x\gt1$.


Keep in mind that you should have a constant of integration in there on one side, which the initial value will let us determine. Also, you've made a mistake in your integration (and a sign error on one side). I recommend using the partial fraction decomposition $$\frac1{t^2-1}=\cfrac{\frac12}{t-1}-\cfrac{\frac12}{t+1}$$ to evaluate the integrals.


This particular equation can be solved by looking at it closely. Notice the equation already looks pretty symmetric in the given form. Once you write it as $$ \frac{\mathrm dx}{x^2-1} = \frac{\mathrm dy}{y^2-1} $$ it becomes obvious that $y=x$ solves this equation. As it turns out, this solution satisfies $y(2)=2$, so we are done.

If you were looking for the general solution, you'd have to do some more work of course, and what you started will get you there when you keep in mind that $\int 1/x\ \mathrm dx=\log|x|+c$ and don't forget the constant.