I was trying to solve the ODE $y'(x) = ay^2(x) +b$ given $a<0 ,b>0, y'(t) >0, y(0)=0$ yet the solution for which I found $y(x)$ doesn't fully fit the ODE.
Calculations I made: $ay^2+b=a(y^2+\frac{b}{a})\Rightarrow \frac{y'}{y^2+\frac{b}{a}} = a$ when $y^2 +\frac{b}{a} \neq 0$ from the given condition $y'(x)\neq0$ and $a<0$.
Integrating both sides $dx$: $\int \frac{y'}{y^2+\frac{b}{a}}dx =ax+c$ assigning $y = z\Rightarrow y' =\frac{dz}{dx} \Rightarrow dx = \frac{dz}{dy'} $ we get: $\int \frac{y'}{y^2+\frac{b}{a}}dx = \int \frac{y'}{y^2+\frac{b}{a}} \frac{1}{y'}dz =_{y'>0} \int \frac{1}{z^2+\frac{b}{a}}dz = arctan(\frac{z}{\sqrt{\frac{-b}{a}}})$
We got: $arctan(\frac{z}{\sqrt{\frac{-b}{a}}}) = ax+c$ from the condition $y(0)=0 \Rightarrow z(0)=0$ we get that $c=0$. so, $arctan(\frac{z}{\sqrt{\frac{-b}{a}}}) = ax \Rightarrow (\frac{z}{\sqrt{\frac{-b}{a}}}) = tan(ax)\Rightarrow z=y(x) =tan(ax)\cdot \sqrt{\frac{-b}{a}} $
The problem is: $y'(x) = (1+tan^2(ax))\cdot a\cdot \sqrt{\frac{-b}{a}} = a(tan^2(ax)\cdot\sqrt{\frac{-b}{a}}+\sqrt{\frac{-b}{a}})\neq a\cdot(tan^2(ax)\cdot \frac{b}{a}+\frac{b}{a}) $
When you're integrating, $$\int \frac{1}{z^2+b/a} {\rm d}z$$
You need to take care that this isn't the format $$\int \frac{1}{x^2+A^2} = \frac 1A \arctan \left( \frac xA \right)$$
Since $\frac{b}{a}$ is negative. This in fact is of the format $$\int \frac{1}{x^2-A^2}= \frac{1}{2A} \ln \left( \left \vert \frac{x-A}{x+A} \right \vert\right)$$ with $A = \sqrt{ -\frac{b}{a}}$.
This is where you went wrong.