Before trying to solve the problem I present here in this note, please make sure that you have read the complete note clearly.

**Problem.** Prove
\[2i\tan^{-1} \left(\frac{ia}{b}\right) = \log \left|\frac{a-b}{a+b}\right|\]
where \(i = \sqrt{-1}\) and \(a,b \in \mathbb{R}\) such that \(a \neq \pm b\)

*Proof.* Ofcoure, you can prove it in a several ways, like simplifying using complex analysis or using series expansion or maybe some other method(s).

But I'll share another elegant solution to the above problem.

Consider the following integral

\[\int_0^x \frac{1}{x^2-a^2} \mathrm{d}x = \frac{1}{2a}\int_0^x \frac{1}{x-a} - \frac{1}{x+a} \mathrm{d}x = \frac{1}{2a} \log \left|\frac{x-a}{x+a}\right|\]

We can also evaluate the above integral as \[\int_0^x \frac{1}{x^2-a^2} \mathrm{d}x = \int_0^x \frac{1}{x^2+(ia)^2} \mathrm{d}x = \frac{i}{a}\tan^{-1} \left(\frac{ix}{a}\right)\]

Thus, \[\frac{i}{a} \tan^{-1} \left(\frac{ix}{a}\right) = \frac{1}{2a} \log \left|\frac{x-a}{x+a}\right|\] \[\Rightarrow 2i \tan^{-1} \left(\frac{ix}{a}\right) = \log \left|\frac{x-a}{x+a}\right| \qquad \qquad \qquad \square\]

Now, here I have a problem. When I tried to verify the above result on Mathematica, it gives me the negative result. Here's a screenshot of my code (in particular, I did it for \(a=1\) and for \(|x| <1\)). I expected Mathematica to return true for all values.

Can somebody help me, where am I going wrong. Is there a flaw in the result that I have proven , or is my Mathematica code wrong?

## Comments

Sort by:

TopNewesti solved the problem in the exact manner ! it was in Arihant level 2 complex problems right?

I too solved it through integration and later i realised that using demoures theorem (means \(e^{ix}\) was much easier , – Mvs Saketh · 2 years ago

Log in to reply

@Mvs Saketh @Raghav Vaidyanathan But did you notice the last line of the note.

Mathematica doesn't gives this result, can you tell me the flaw in my code? – Kishlaya Jaiswal · 2 years ago

Log in to reply

– Raghav Vaidyanathan · 2 years ago

I'm sorry, I do not know mathematica. But I do know that wolfram if not error free. Your result seems correct to me, but I am not able to see why you are getting false values.Log in to reply

@Agnishom Chattopadhyay has already resolved the error. (Read our conversation below) – Kishlaya Jaiswal · 2 years ago

Yep,Log in to reply

– Agnishom Chattopadhyay · 2 years ago

See my comment for an explanation.Log in to reply

– Raghav Vaidyanathan · 2 years ago

I derived this integral in some boring class and thought it was something great. Then I found out that using \(e^{i\theta}\), this thing is very elementary.Log in to reply

@bobbym none I'd like you to throw some light on this – Agnishom Chattopadhyay · 2 years ago

Log in to reply

– Bobbym None · 2 years ago

Mr Chattopadhyay; Your later comments are on the right track. You should follow a discussion that phrontister and I had a long time ago...Log in to reply

The fallacy is in the definite integrals.

In a similar way, one could prove that sin^2(x) = -cos^2(x)

\[ \int^x_0{\sin x \cos x \, dx} = \int^x_0{(\sin x) d(\sin x) } = \frac{1}{2} \sin^2 x \]

\[ \int^x_0{\sin x \cos x \, dx} = \int^x_0{-(\cos x) d(\cos x) } = -\frac{1}{2} \cos^2 x \]

\[ \implies \sin^2 x = - \cos^2 x \] – Agnishom Chattopadhyay · 2 years ago

Log in to reply

\[\int_0^x \sin x \cos x dx = \int_0^1 -(\cos x)d(\cos x) = -\frac{1}{2}\left(\cos^2 x\right|_0^x = -\frac{1}{2}\left(\cos^2 x - 1\right) = \frac{1}{2}(1-\cos^2 x) = \frac{1}{2} \sin^2 x\] – Kishlaya Jaiswal · 2 years ago

Log in to reply

Sorry to confuse you, I don't think the problem is with the integral.

The problem is with the

`N`

function. Because it forces the software to convert both sides to numeric expressions, it is unlikely that they'll be the same.I am not exactly sure why it happens but something like this might happen: Mathematica's calculation of one side may converge faster than the other. For example, if both sides are \(\sqrt{2}\), one might converge to 1.41 and another to 1.414 after a certain number of iterations.

In computation, many a times a 0 and a small 'weed' error are often indistinguishable.

To make sure what I am talking about is not crap, run the following:

See how small the values are?

Okay, let us resort to symbolic computation!

Run the code! Does it satisfy you? – Agnishom Chattopadhyay · 2 years ago

Log in to reply

And also,

gives me all real solutions.

A great thanks to you for pointing it out. \(\ddot \smile\) – Kishlaya Jaiswal · 2 years ago

Log in to reply

– Agnishom Chattopadhyay · 2 years ago

You are Welcome. :)Log in to reply

\[ \int \sin x \cos x \, dx = \int \sin x \, d \sin x = \frac{1}{2} \sin ^ 2 x \]

\[ \int \sin x \cos x \, dx = \int - \cos x \, d \cos x = - \frac{1}{2} \cos ^ 2 x \]

Hence, this would lead someone to claim that \( \sin^2 x = - \cos ^2 x \).

This is a common example used to represent this mistake, which is that \( \int f \, dx = F(x) + C \), as opposed to \( \int f\, dx = F(x) \). This appears numerous times, even on Brilliant. E.g. we've had to delete a lot of questions that say " Evaluate \( \int f\, dx \) at \( x = 0 \)", because they didn't make sense due to the \( + C \) which was forgotten.

Do you see how the mistake comes into play here? – Calvin Lin Staff · 2 years ago

Log in to reply

– Agnishom Chattopadhyay · 2 years ago

Yep, the constant is -1/2 ;)Log in to reply

Also, if still there is fallacy, then can you please pin-point the wrong step.

And please do share the fallacy which proves that \(\sin^2x = \cos^2x\) – Kishlaya Jaiswal · 2 years ago

Log in to reply

– Agnishom Chattopadhyay · 2 years ago

I'm not sure of the exact fallacy but check the last comment again :)Log in to reply