gives the secant of z.


  • Mathematical function, suitable for both symbolic and numerical manipulation.
  • The argument of Sec is assumed to be in radians. (Multiply by Degree to convert from degrees.)
  • .
  • 1/Cos[z] is automatically converted to Sec[z]. TrigFactorList[expr] does decomposition.
  • For certain special arguments, Sec automatically evaluates to exact values.
  • Sec can be evaluated to arbitrary numerical precision.
  • Sec can be used with Interval and CenteredInterval objects. »
  • Sec automatically threads over lists.

Background & Context

  • Sec is the secant function, which is one of the basic functions encountered in trigonometry. It is defined as the reciprocal of the cosine function: . It is defined for real numbers by letting be a radian angle measured counterclockwise from the axis along the circumference of the unit circle. Sec[x] then gives the reciprocal of the horizontal coordinate of the arc endpoint. The equivalent schoolbook definition of the secant of an angle in a right triangle is the ratio of the length of the hypotenuse to the length of the leg adjacent to .
  • Sec automatically evaluates to exact values when its argument is a simple rational multiple of . For more complicated rational multiples, FunctionExpand can sometimes be used to obtain an explicit exact value. TrigFactorList can be used to factor expressions involving Sec into terms containing Sin and Cos. To specify an argument using an angle measured in degrees, the symbol Degree can be used as a multiplier (e.g. Sec[30 Degree]). When given exact numeric expressions as arguments, Sec may be evaluated to arbitrary numeric precision. Other operations useful for manipulation of symbolic expressions involving Sec include TrigToExp, TrigExpand, Simplify, and FullSimplify.
  • Sec threads element-wise over lists and matrices. In contrast, MatrixFunction can be used to give the secant of a square matrix (i.e. the power series for the secant function with ordinary powers replaced by matrix powers) as opposed to the secants of the individual matrix elements.
  • Sec is periodic with period , as reported by FunctionPeriod. Sec is periodic with period , as reported by FunctionPeriod. Sec satisfies the identity , which is equivalent to the Pythagorean theorem. The definition of the secant function is extended to complex arguments using the definition , where is the base of the natural logarithm. Sec has poles at for an integer and evaluates to ComplexInfinity at these points. Sec[z] has series expansion sum_(k=0)^infty((-1)^k TemplateBox[{{2,  , k}}, EulerE])/((2 k)!)z^(2 k) about the origin that may be expressed in terms of the Euler numbers EulerE.
  • The inverse function of Sec is ArcSec. The hyperbolic secant is given by Sech. Other related mathematical functions include Cos and Csc.


open allclose all

Basic Examples  (7)

The argument is given in radians:

Use Degree to specify an argument in degrees:

Evaluate numerically:

Plot over a subset of the reals:

Plot over a subset of the complexes:

Series expansion at 0:

Asymptotic expansion at a singular point:

Scope  (47)

Numerical Evaluation  (5)

Evaluate to high precision:

The precision of the output tracks the precision of the input:

Evaluate for complex arguments:

Evaluate Sec efficiently at high precision:

Sec threads elementwise over lists and matrices:

Sec can be used with Interval and CenteredInterval objects:

Specific Values  (6)

Values of Sec at fixed points:

Values at infinity:

Singular points of Sec:

Local extrema of Sec:

Find a local minimum of Sec as a root of :

Substitute in the result:

Visualize the result:

Simple exact values are generated automatically:

More complicated cases require explicit use of FunctionExpand:

Visualization  (3)

Plot the Sec function:

Plot the real part of :

Plot the imaginary part of :

Polar plot with :

Function Properties  (13)

The real domain of Sec:

Complex domain:

Sec achieves all real values except the open interval :

Sec is a periodic function with a period :

Sec is an even function:

Sec has the mirror property sec(TemplateBox[{z}, Conjugate])=TemplateBox[{{sec, (, z, )}}, Conjugate]:

Sec is not an analytic function:

However, it is meromorphic:

Sec is monotonic in a specific range:

Sec is not injective:

Sec is not surjective:

Sec is neither non-negative nor non-positive:

It has both singularity and discontinuity when x is a multiple of π/2:

Neither convex nor concave:

It is convex for x in [-1.5,1.5]:

TraditionalForm formatting:

Differentiation  (3)

First derivative:

Higher derivatives:

Formula for the ^(th) derivative:

Integration  (3)

Indefinite integral of Sec:

Definite integral of Sec over a period is 0:

More integrals:

Series Expansions  (4)

Find the Taylor expansion using Series:

Plot the first three approximations for Sec around :

General term in the series expansion of Sec:

Fourier series of Sec:

Sec can be applied to power series:

Function Identities and Simplifications  (6)

Sec of a double angle:

Sec of a sum:

Convert multipleangle expressions:

Convert sums of trigonometric functions to products:

Expand assuming real variables and :

Convert to complex exponentials:

Function Representations  (4)

Representation through Sin:

Representation through Bessel functions:

Representation through SphericalHarmonicY:

Representation in terms of MeijerG:

Applications  (4)

Generate a plot with poles removed:

Generate a plot over the complex argument plane:

Solve a differential equation:

Pursuit curve in the reference frame of the predator with prey moving half as fast along a line:

Properties & Relations  (10)

Basic parity and periodicity properties of the secant function get automatically applied:

Use TrigFactorList to factor Sec into Sin and Cos:

Complicated expressions containing trigonometric functions do not autosimplify:

Evaluate under additional assumptions:

Compositions with the inverse functions:

Solve a trigonometric equation:

Solve for zeros and poles:

Numerically solve a transcendental equation:

Sec is automatically returned as a special case for many mathematical functions:

Calculate residue symbolically and numerically:

Possible Issues  (5)

Machine-precision input is insufficient to give a correct answer:

With exact input, the answer is correct:

A larger setting for $MaxExtraPrecision is needed:

For arguments with imaginary part too large, the result cannot be represented by a computer:

The precision of the output can be much smaller or larger than the precision of the input:

In TraditionalForm, parentheses are needed around the argument:

Neat Examples  (6)

Various integrals and products:

Plot Sec at integer points:

Generate the Sec function from integrals and sums:

Wolfram Research (1988), Sec, Wolfram Language function, (updated 2021).


Wolfram Research (1988), Sec, Wolfram Language function, (updated 2021).


Wolfram Language. 1988. "Sec." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021.


Wolfram Language. (1988). Sec. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2023_sec, author="Wolfram Research", title="{Sec}", year="2021", howpublished="\url{}", note=[Accessed: 12-April-2024 ]}


@online{reference.wolfram_2023_sec, organization={Wolfram Research}, title={Sec}, year={2021}, url={}, note=[Accessed: 12-April-2024 ]}