Basically the question is about using Solve
as the most straightforward tool for finding exact solutions however all the other existing answers demonstrate numerical techniques and find approximate solutions. It was observed in the comments that 2 E^(-y)/(1 + E^(-2 y)) == Sech[y] == 1/Cosh[y]
. As Cosh[y]
is an exponentially increasing function it is obvious that there are infinitely many solutions of the given equations very close to those of this trivial equation Cos[y] == 0
. Solve
will not give any solutions unless it is suplemented by an appropriate codition restricting the space of solutions to a finite number of them. There were many asnwers discussing this issue and it is easy to find them on this site. The exact solutions of transcendental equations in Mathematica are given in terms of the Root
objects since the version 7, see e.g. this post by
Roger Germundsson
Mathematica 7, Johannes Kepler, and Transcendental Roots.
Since we would like to find the first 10
solutions and having said the remarks above we conclude that the condition supplementing the equation should be roughly 0 <= y <= 10 Pi
but to be ensured one can put 0 <= y <= 11 Pi
.
Now we can use Solve
as well as Reduce
, e.g.
sols = DeleteDuplicates[ y /. Solve[ Cos[y] - 2 E^(-y)/(1 + E^(-2 y)) == 0
&& 0 <= y <= 35, y]];
We have used DeleteDuplicates
because Solve
produces four copies of the same solution for y == 0
. In fact we have obtained all the desired solutions:
Length @ sols
11
All the above is true if we asume we need only real roots. However if we are to find all complex solutions we need to do it this way:
solComp = ReIm[y]/.{ ToRules @ Reduce[ Cos[y] - 2 E^(-y)/(1 + E^(-2 y)) == 0
&& 0 <= Abs[y] <= 12, y]};
ContourPlot[
{ Re[Cos[x + I y] - 2 E^(-x - I y)/(1 + E^(-2 (x + I y)))],
Im[Cos[x + I y] - 2 E^(-x - I y)/(1 + E^(-2 (x + I y)))]},
{x, -11, 11}, {y, -11, 11},
PlotPoints -> 75, MaxRecursion -> 5,
Epilog -> {Table[{Dashed, Gray, Circle[{0, 0}, i]}, {i, sols[[2;;4]]}],
Red, PointSize[0.015], Point[solComp]},
PlotLegends -> Placed["Expressions", Bottom]]

This plot sheds some light why Solve
finds four copies of trivial solution z == x + I y == 0
. Moreover we can find that on the both axes roots are in equal distances from the origin exchanging x
and y
because the equation is equivalent to Cos[x + I y] == 1/Cosh[x + I y]
and {Cos[I y], Cosh[I y]}
yields {Cosh[y], Cos[y]}
i.e. they exchange their roles. However on the level of the given function 1/Cosh[x + I y]
becomes 1/Cos[y]
for x == 0
and this is why there occurs a singularity when Cos[y] == 0
.
Reduce[Cosh[x + I y] == 0 && -(1/4) < x < 1/4 && 5/4 < y < 7/4, {x, y}]
x == 0 && y == Pi/2
This is a the first singular point of Sech[ x + I y]
.
In case of more sophisticated equations one should plot given functions to estimate the range 0 <= y <= yMax
. Let's plot the first 10
real and positive roots:
Plot[ Cos[y] - 2 E^(-y)/(1 + E^(-2 y)), {y, 0, 35},
Epilog -> {Red, PointSize[0.02], Point[Tuples[{sols, {0}}]]}]

Approximate values of y
one finds with
N @ sols
{ 0., 4.73004, 7.8532, 10.9956, 14.1372, 17.2788, 20.4204,
23.5619, 26.7035, 29.8451, 32.9867}
and as I pointed out earlier differences between consecutive roots tend to Pi
:
Differences @ %
{ 4.73004, 3.12316, 3.1424, 3.14156, 3.14159, 3.14159, 3.14159,
3.14159, 3.14159, 3.14159}
quite rapidly, what give us an estimation for the condition 0 <= y <= yMax
to find much more exact solutions.
Here we demonstrate the structure of contours {Re[f[z]==0, Im[f[z]==0}
near the first singular point on the imaginary axis.
cp = ContourPlot[
{ Re[Cos[x + I y] - 2 E^(-x - I y)/(1 + E^(-2 (x + I y)))] == 0,
Im[Cos[x + I y] - 2 E^(-x - I y)/(1 + E^(-2 (x + I y)))] == 0},
{x, -2.2, 2.2}, {y, -2.2, 2.2}, ContourStyle -> {Orange, Green},
Epilog -> {Red, PointSize[0.015], Point[solComp]}, PlotPoints -> 75,
MaxRecursion -> 5];
GraphicsRow[
Table[ Show[
ContourPlot[{ f[Cos[x + I y] - 2 E^(-x - I y)/(1 + E^(-2 (x + I y)))]},
{x, -2.2, 2.2}, {y, -2.2, 2.2}, PlotPoints -> 100, MaxRecursion -> 5,
ColorFunction -> ColorData["DeepSeaColors"]], cp], {f, {Re, Im}}]]

Althought the green and orange lines intersect, there is no root since a singular point does not belong to the domain of the underlying function.
FindRoot[Cos[y] - 2 E^(-y)/(1 + E^(-2 y)), {y, 1}]
? $\endgroup$2 E^(-y)/(1 + E^(-2 y))
is the same asSech[y]
. $\endgroup$