<s>[INST] Integrating $\int{\frac{x\,dx}{x^2 + 3x -4}}$ I saw this "Beat the Integral" problem and wanted to be sure I was approaching it correctly.
The integral is $$\int{\frac{x}{x^2 + 3x -4}dx}$$
So I decide I want to decompose this, because it's a degree-2 polynomial in the denominator and a degree-1 in the numerator, so that'd be a go-to. Also, since the degree of th enumerator is one less than the denominator we can maybe treat this as $du/u$ which would imply a natural log, though we don't quite know that yet.
So we decompose: I know that $x^2+3x-4$ can be factored as $(x-1)(x+4)$.
That gets me
$$\int{\frac{x}{(x-1)(x+4)}dx}$$
so I can do this:
$$\frac{Ax}{x-1}+\frac{B}{x+4} = \frac{x}{(x-1)(x+4)}$$
Which implies
$$A(x+4)+B(x-1) = x$$
and since the roots are at $x=1$ and $x=-4$, I can set it up like this:
$$5A = 1;-5B=1 \text{  and } A = \frac{1}{5}, B=-\frac{1}{5}$$
Leading to:
$$\frac{x}{5(x-1)}-\frac{1}{5(x+4)}$$
Which I can set up the integral like so:
$$\int{\frac{x}{5(x-1)}-\frac{1}{5(x+4)}dx}=\int{\frac{x}{5(x-1)}dx-\int{\frac{1}{5(x+4)}dx}}$$
I can now integrate by addition here  $$\int{\frac{x}{x-1}}dx=\int{\frac{x-1+1}{x-1}}dx=x+\int{\frac{1}{x-1}}dx=x-\ln(x-1)$$
And doing the same thing for the second term and bringing back my $\frac{1}{5}$
$$\frac{1}{5}(x-\ln(x-1)+\ln(x+4))$$
I suspect there is a further simplification I could do. On a problem like this I also saw it integrated as an arctangent, but that seemed needlessly complex? In any case I was curious if I did this correctly.
 [/INST] HINT
Here it is an alternative way to solve it:
\begin{align*}
\frac{x}{(x-1)(x+4)} & = \frac{(x-1) + 1}{(x-1)(x+4)}\\\\
& = \frac{1}{x+4} + \frac{1}{(x-1)(x+4)}\\\\
& = \frac{1}{x+4} + \frac{1}{5}\times\frac{(x+4) - (x-1)}{(x-1)(x+4)}\\\\
& = \frac{1}{x+4} + \frac{1}{5}\times\left[\frac{1}{x-1} - \frac{1}{x+4}\right]\\\\
& = \frac{1}{5(x-1)} + \frac{4}{5(x+4)}
\end{align*}
Can you take it from here?
</s>