So I have this function:

$$ \int_{-\infty}^{\infty} \mathrm {sech}(x+s)^{2} {\rm sech}(x)^{2}dx$$

And when I try to integrate it, I can obtain the indefinite integral:

In[42]:= Integrate[Cosh[x + s]^-2*Cosh[x]^-2, x]

Out[42]= -2 Coth[s] Csch[s]^2 Log[Cosh[x]]+2Coth[s] Csch[s]^2 Log[Cosh[s + x]]-Csch[s]^2 Sech[s] Sech[s+x] Sinh[x]-Csch[s]^2Tanh[x]

But when I evaluate the limits, it cancels to $0$. The solution I was given stated that the answer should be some form of:

$$\frac{\cosh(s)\cdot s}{\sinh(s)^3}- \frac{1}{\sinh(s)^2} $$

None of what I'm doing seems to get me the answer and as you can see, it's not like Mathematica even makes the output easy to parse.


2 Answers 2


Try the definite integral

Integrate[Cosh[x + s]^-2*Cosh[x]^-2, {x, -Infinity,Infinity}]
(*2 Csch[s]^2 (-2 + Coth[s] Log[E^(2 s)]) if ...*)

which Mathematica conditional solves.

Numerical "confirmation"

int[s_?NumericQ] := 
   Cosh[x + s]^-2*Cosh[x]^-2, 
   {x, -Infinity, Infinity}]    

Plot[{int[s], 2 Csch[s]^2 (-2 + Coth[s] Log[E^(2s)])} , {s, -10, 10},PlotStyle -> {Automatic, Dashed}]

enter image description here


(* "12.2.0 for Mac OS X x86 (64-bit) (December 12, 2020)" *)


expr = Cosh[x + s]^-2*Cosh[x]^-2;

An indefinite integral (anti-derivative) of expr is

ad = Integrate[expr, x] // Simplify

(* -Csch[s]^2 (2 Coth[s] (Log[Cosh[x]] - Log[Cosh[s + x]]) + 
   Sech[s] Sech[s + x] Sinh[x] + Tanh[x]) *)

Verifying that ad is a valid anti-derivative of expr

D[ad, x] == expr // Simplify

(* True *)

The definite integral is then

int1 = Limit[ad, x -> Infinity] - Limit[ad, x -> -Infinity] // Simplify

(* -2 Csch[s]^2 (2 + Coth[s] (Log[E^-s] - Log[E^s])) *)

Calculating the definite integral directly

int2 = Integrate[expr, {x, -Infinity, Infinity}]

enter image description here

The results are equivalent for real s

diff = int1 - int2 // Simplify[#, Element[s, Reals]] &

(* 0 *)


Plot[{int1, int2}, {s, -10, 10},
 PlotStyle -> {Automatic, Dashed}]

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.