# $\int\frac{g(x)}{f(x)} \, dx$ where $f(x) = \frac{1}{2}(e^x+e^{-x})$ and $g(x) = \frac{1}{2}(e^x - e^{-x})$?

Given two functions $$f(x) = \frac{1}{2}(e^x+e^{-x})$$ and $$g(x) = \frac{1}{2}(e^x - e^{-x})$$, calculate

$$\int\frac{g(x)}{f(x)} \, dx.$$

Observing that $$f'(x) = g(x)$$, this is very easy to do. Just take $$u = f(x)$$ and therefore $$du = f'(x)\,dx$$. Now we have

$$\int \frac{f'(x)}{f(x)} \, dx = \int \frac{du}{u} = \ln |u| + C = \ln\left|\frac{1}{2}(e^x+e^{-x})\right|+C.$$

However, this solution is wrong. The correct one is $$\ln|e^x+e^{-x}| + C$$. I see how we could get that, just plug in $$g(x)$$ and $$f(x)$$ directly, and we get

$$\int \frac{\frac{1}{2}(e^x - e^{-x})}{\frac{1}{2}(e^x+e^{-x})} \, dx.$$

Cancelling the $$\frac{1}{2}$$'s and taking $$u = e^x+e^{-x}$$ and $$du = (e^x-e^{-x}) dx$$ gives us

$$\int \frac{du}{u} = \ln|u| + C = \ln|e^x+e^{-x}| + C.$$

I can't see where I made a mistake in my approach, and I'd be really grateful if you pointed it out.

• Please try to make the titles of your questions more informative. For example, Why does $a<b$ imply $a+c<b+c$? is much more useful for other users than A question about inequality. From How can I ask a good question?: Make your title as descriptive as possible. In many cases one can actually phrase the title as the question, at least in such a way so as to be comprehensible to an expert reader. You can find more tips for choosing a good title here. – Shaun May 22 at 18:47
• Thanks, I will do that next time. :) – Gregor Perčič May 22 at 19:01
• I feel terrible mentioning it because I know you're only trying to be polite but could you remove the religious elements at the end? There are likely many faiths none should be given a platform – Karl May 22 at 19:10
• @Karl With all due respect, I will not remove it. It is very good to try to propagate the Faith in all contexts of life. The mods may remove it, but hey, I did my best. Not to mention that my right to free speech will be trampled on in this instance. – Gregor Perčič May 22 at 19:29
• I ment no offence honestly. I'd just rather stick to maths. – Karl May 22 at 19:38

Note that if $$K$$ is a constant, $$\ln|K h(x)|= \ln|K|+\ln|h(x)|$$. In other words, the $$1/2$$ in the log can get 'absorbed' into the $$+C$$ term.
• Aaaaah, I see! But then that means that my solution $\ln|\frac{1}{2}(e^x + e^{-x})| + C$ doesn't by itself (with $C = 0$) calculate the area under the curve $h(x) = \frac{f(x)}{g(x)}$? – Gregor Perčič May 22 at 19:00
• It seems $f$ and $g$ are reversed in your comment. It should, in the sense that $$\int _{0}^x \frac{g(t)}{f(t)}\,dt = \left.\ln|\frac{1}{2}(e^t + e^{-t})|+C\right|_{0}^x$$ $$= \left(\ln|\frac{1}{2}(e^x + e^{-x})|+C\right)-\left(\ln|\frac{1}{2}(1+1)|+C\right)=\ln|\frac{1}{2}(e^x + e^{-x})|$$The $1/2$ is essential to make sure, starting at $x=0$, the area is $0$; otherwise, you'll be off by a constant. – Integrand May 22 at 19:25
• Yes, $f$ and $g$ are reversed. Sorry about that and thanks for the insight. – Gregor Perčič May 22 at 19:32
Using the identity: $$\log (\frac{a}{b})=\log(a)- \log(b)$$
$$\ln \frac{1}{2}(e^x+e^{-x})+C$$
$$=\ln (e^x+e^{-x})-\ln 2+C$$
$$=\ln (e^x+e^{-x})+C{'}$$ (as $$\ln 2$$ is constant)