I watched this Michael Penn video and it lead me to try a couple of things and they ended up not working.
Specifically, he solves the following problem like so
Starting with $y'' = y$
$y'' - y = 0$
$\left( (\frac{d}{dx})^2 - I \right)y = 0$
And because $I$ is the identity operator, then $I = I^2$, so
$\left( (\frac{d}{dx})^2 - I^2 \right)y = 0$
$\left( (\frac{d}{dx}) - I \right) \left( (\frac{d}{dx}) + I \right)y = 0$
Then he sets
$\left( (\frac{d}{dx}) + I \right)y = Y$
So now we have
$\left( (\frac{d}{dx}) - I \right)Y = 0$
Which we can solve for $Y = Ae^x$
And to summarize, we can then use this in $\left( (\frac{d}{dx}) + I \right)y = Ae^x$ and solve for $y$ using an integrating factor. It's all neat stuff. I've never seen this kind of problem solved this way though and I found it fascinating. But I'm clearly very new to this idea. So I'm curious about why it can't be used in the following way.
$y'' + fy' + gy = 0$
$\left( (\frac{d}{dx})^2 + f \frac{d}{dx} + g \right)y = 0$
$\left( (\frac{d}{dx})^2 + f \frac{d}{dx} + g \right) = 0$
Then using pythag
$\frac{d}{dx} = - \frac{f}{2} \pm \sqrt{\frac{f^2}{4} - g}$
Putting the y back in
$\frac{dy}{dx} = y\left( - \frac{f}{2} \pm \sqrt{\frac{f^2}{4} - g} \right)$
At this point, it's pretty straight forward to solve for $y$.
$y = Ae^{\int{ \left( - \frac{f}{2} \pm \sqrt{\frac{f^2}{4} - g}\right)}dx}$
Now this doesn't work, and frankly, I wasn't really expecting it to work, mostly curious about what would pop out. But the question I have is why doesn't this work. How does operator algebra work? Please enlighten me?
Actually, factorization of differential operators is a valid technique in solving differentials equations, but the way you did it only works in the case where $f,g$ are constants, so that everything commutes.
Let's assume you have a differential operator $L$ which can be factored as $L=AB$. Then, the problem $Ly=ABy=0$ can be decomposed into the sub-problems $Ay=0$ and $By=0$ if and only if $A$ and $B$ commute, as in Michael Penn's video.
If those differential operators do not commute, you will have to solve $Ay=0$ to begin with and afterwards the inhomogeneous problem $By = y_A$, where $y_A$ is the general solution to the first equation $Ay=0$ $-$ so that the general solution satisfies $Ly = ABy = Ay_A = 0$.
In your second example, you could take : $$ \begin{array}{l} L = \frac{\mathrm{d}^2}{\mathrm{d}x^2} + f(x)\frac{\mathrm{d}}{\mathrm{d}x} + g(x) \\\\ A = \frac{\mathrm{d}}{\mathrm{d}x} + \alpha(x) \\\\ B = \frac{\mathrm{d}}{\mathrm{d}x} + \beta(x) \end{array} $$ so that $$ Ly = ABy = \left(\frac{\mathrm{d}}{\mathrm{d}x} + \alpha\right) \left(\frac{\mathrm{d}}{\mathrm{d}x} + \beta\right) y = y'' + (\alpha+\beta)y' + (\alpha\beta+\beta')y $$ hence $$ \left\{ \begin{array}{l} f = \alpha+\beta \\ g = \alpha\beta+\beta' \end{array} \right. \verb+ +\Rightarrow\verb+ + \beta'= g-\alpha\beta = g - f\beta + \beta^2 $$ which is a quite complicatede first-order nonlinear ODE for $\beta$ depending on the given functions $f,g$.
Once you have found $\alpha$ and $\beta$ (if possible), you still need to solve the new problems : $$ \left\{ \begin{array}{l} \left(\frac{\mathrm{d}}{\mathrm{d}x} + \alpha\right)y_A = 0 \\ \left(\frac{\mathrm{d}}{\mathrm{d}x} + \beta\right)y = y_A \end{array} \right. $$ But those are standard first-order linear ODE.