Purpose

Return value

Syntax

=TAN(number)
  • number - The angle in radians for which you want the tangent.

Using the TAN function

The TAN function returns the tangent of an angle provided in radians . For example, given the π/4 as input, the function returns 1.0 as output.

=TAN(PI()/4) // Returns 1

To supply an angle in degrees, use the radians function.

=TAN(RADIANS(45)) // Returns 1

Explanation

In math, the tangent of an angle is defined as the ratio of the opposite side to the adjacent side of a right triangle.

Tangent function definition. - 1

The definition of tangent is extended to all angles by defining the function in terms of the angle formed by a point on the unit circle.

Tangent function unit circle definition. - 2

The plot below visualizes the output of tangent for angles between -π and π. The red lines represent vertical asymptotes where the function diverges to positive and negative infinity.

Plot of the tangent function with asymptotes. - 3

Even though the function is undefined at its vertical asymptotes, Excel does not return an error for input at or near these vertical asymptotes. For example, see the following table for input around and including the location of the asymptote at the angle π/2.

Tangent function output at vertical asymptote. - 4

This is because the tangent function is likely defined in terms of the functions sine and cosine like this:

=SIN(a)/COS(a) // equivalent to TAN(a)

It’s reasonable to expect that the output of cosine for the angle π/2 should be zero, meaning you would get a division by zero error for tangent at the same input. However, Excel’s formula engine calculates this value as a very small value that is close to, but not quite equal to, zero.

=COS(PI()/2) // returns 6.12323E-17 instead of zero

As a result, the tangent of π/2 does not return an error and instead returns a very large value.

=TAN(PI()/2) // returns 1.63312E+16

Images courtesy of wumbo.net .

Purpose

Return value

Syntax

=TANH(number)
  • number - The input number.

Using the TANH function

The TANH function returns a number’s hyperbolic tangent. Given input -2, the function returns the number -0.96402758 as output.

=TANH(-2) // returns -0.96402758

Explanation

Just like the circular tangent, the hyperbolic tangent is defined in terms of the hyperbolic sine and hyperbolic cosine.

=SINH(a)/COSH(a) // definition of TANH(a)

Geometrically, the hyperbolic tangent of a number can be interpreted as the slope of the line from the origin to the point on the unit hyperbola corresponding to the number’s hyperbolic angle where the hyperbolic angle is half the area under the hyperbola between the origin and that point.

Hyperbolic tangent geometry. - 5

For example, given the input of -1 the function returns -0.761594156.

=TANH(-1) // returns the slope of -0.761594156

This value can be interpreted as the slope of the line from the origin to the point corresponding to the hyperbolic angle of -1.

Hyperbolic tangent geometry example input. - 6

Plot of TANH

The plot of the hyperbolic tangent is shown below and visualizes the range of possible output of the function.

Plot of the hyperbolic tangent function. - 7

Images courtesy of wumbo.net .