I am trying to use variation of parameters to find the general solution to the inhomogeneous ODE $$u''-u=\frac{2}{e^x+1}$$
By computing the characteristic polynomial of the homogeneous equation $u''-u=0$, I have found $$u_H=c_1e^x+c_2e^{-x} \ \ \ \ c_1,c_2\in\mathbb{R}$$ Hence $u_1(x)=e^x, u_2(x)=e^{-x}$. So, \begin{align} v'_1(x)&=-\frac{u_2(x)f(x)}{W(x)} \\ v_1(x)&=\int \frac{e^{-x}}{e^x+1} \ dx \\ &=-e^{-x}+\ln|e^{-x}+1|+C_1 \end{align}
and similarly, \begin{align} v'_2(x)&=\frac{u_1(x)f(x)}{W(x)} \\ v_2(x)&=-\int \frac{e^{x}}{e^x+1} \ dx \\ &=-\ln|e^{x}+1|+C_2 \end{align}
Hence the general solution is given by $$u(x)=v_1(x)u_1(x)+v_2(x)u_2(x)=\left(-e^{-x}+\ln|e^{-x}+1|+C_1\right)e^x+\left(-\ln|e^{x}+1|+C_2\right)e^{-x}$$ But this is incorret. Is my method valid?
First, $$W(x)=\det\left(\begin{bmatrix}\exp(x)&\exp(-x)\\\exp(x)&-\exp(-x)\end{bmatrix}\right)=-2\,.$$
That is, with a proper constant of integration, $$\begin{align}v_1(x)&=-\int\,\frac{u_2(x)\,f(x)}{W(x)}\,\text{d}x \\&=-\exp(-x)+\ln\big(1+\exp(-x)\big)=-\exp(-x)-x+\ln\big(1+\exp(x)\big)\,.\end{align}$$ Likewise, for an appropriate choice of the constant of integration, we have $$v_2(x)=+\int\,\frac{u_1(x)\,f(x)}{W(x)}\,\text{d}x=-\ln\big(1+\exp(x)\big)\,.$$ Thus, a particular solution is $$\begin{align}u_p(x)&=v_1(x)\,u_1(x)+v_2(x)\,u_2(x) \\&=\small\exp(+x)\,\Big(-\exp(-x)-x+\ln\big(1+\exp(x)\big)\Big)-\exp(-x)\,\ln\big(1+\exp(x)\big) \\ &=-1-x\,\exp(x)+2\,\sinh(x)\,\ln\big(1+\exp(x)\big)\,.\end{align}$$ Hence, the general solutions are of the form $$u(x)=u_p(x)+a\,\exp(+x)+b\,\exp(-x)\,,$$ where $a$ and $b$ are constants. My result agrees with you.
Alternatively, note that $$\frac{\text{d}}{\text{d}x}\,\exp(x)\,\big(u'(x)-u(x)\big)=\frac{2\,\exp(x)}{\exp(x)+1}\,.$$ That is, $$u'(x)-u(x)=\int\,\frac{\exp(x)}{\exp(x)+1}\,\text{d}x=2\,\exp(-x)\,\ln\big(\exp(x)+1\big)-2A\,\exp(-x)$$ for some constant $A$. That is, $$\frac{\text{d}}{\text{d}x}\,\exp(-x)\,u(x)=2\,\exp(-2x)\,\ln\big(\exp(x)+1\big)-2A\,\exp(-2x)\,.$$ Ergo, $$u(x)=\exp(+x)\,\int\,2\,\exp(-2x)\,\ln\big(\exp(x)+1\big)\,\text{d}x+A\,\exp(-x)\,.$$ Using integration by parts, we obtain $$\int\,2\,\exp(-2x)\,\ln\big(\exp(x)+1\big)\,\text{d}x=-\exp(-x)-x+2\exp(-x)\,\sinh(x)\,\ln\big(1+\exp(x)\big)+B$$ for some constant $B$, and so we conclude that $$u(x)=-1-x\,\exp(x)+2\,\sinh(x)\,\ln\big(1+\exp(x)\big)+A\,\exp(-x)+B\,\exp(+x)\,.$$