Sec[z]
gives the secant of z.
Sec
Sec[z]
gives the secant of z.
Details
- 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 automatically threads over lists. »
- Sec can be used with Interval and CenteredInterval objects. »
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
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.
Examples
open all close allBasic Examples (7)
The argument is given in radians:
Sec[Pi / 6]Use Degree to specify an argument in degrees:
Sec[30Degree]Sec[1.2]Plot over a subset of the reals:
Plot[Sec[x], {x, 0, 2Pi}]Plot over a subset of the complexes:
ComplexPlot3D[Sec[z], {z, -π - I, π + I}, PlotLegends -> Automatic]Series[Sec[x], {x, 0, 10}]Asymptotic expansion at a singular point:
Series[Sec[x], {x, 3 π / 2, 5}]Scope (47)
Numerical Evaluation (5)
N[Sec[12 / 10], 50]The precision of the output tracks the precision of the input:
Sec[1.20000000000000000000000]Evaluate for complex arguments:
Sec[2.5 + I]Evaluate Sec efficiently at high precision:
Sec[1.2`500]//TimingSec[1.2`100000];//TimingCompute the elementwise values of an array using automatic threading:
Sec[ {{5π / 6, 0}, {π / 6, -π / 4}}]Or compute the matrix Sec function using MatrixFunction:
MatrixFunction[Sec[#]&, {{5π / 6, 0}, {π / 6, -π / 4}}]Compute worst-case guaranteed intervals using Interval and CenteredInterval objects:
Sec[Interval[{Pi / 6, Pi / 3}]]Sec[CenteredInterval[1, 1 / 100]]Sec[CenteredInterval[1 + 2I, (1 + I) / 100]]Or compute average-case statistical intervals using Around:
Sec[Around[2, 0.01]]Specific Values (6)
Values of Sec at fixed points:
Table[Sec[n (π/6)], {n, -2, 2}]Sec[Infinity]Sec[ComplexInfinity]Singular points of Sec:
Assuming[m∈Integers, Refine[Sec[π ((1/2) + m)]]]Local extrema of Sec:
Assuming[m∈Integers, FullSimplify[Refine[Sec[π m]]]]Find a local minimum of Sec as a root of
:
sol = Solve[D[Sec[x], x] == 0 && -(π/2) < x < (π/2), x]xmin = x /. First[sol]Plot[Sec[x], {x, -π / 2, π / 2}, Epilog -> Style[Point[{xmin, Sec[xmin]}], PointSize[Large], Red]]Simple exact values are generated automatically:
Sec[Pi / 5]More complicated cases require explicit use of FunctionExpand:
Sec[Pi / 30]FunctionExpand[%]Visualization (3)
Plot the Sec function:
Plot[Sec[x], {x, 0, 4π}]ComplexContourPlot[Re[Sec[z]], {z, -2π - π I, 2π + π I}, IconizedObject[«PlotOptions»]]ComplexContourPlot[Im[Sec[z]], {z, -2π - π I, 2π + π I}, IconizedObject[«PlotOptions»]]Table[PolarPlot[Sec[k ϕ], {ϕ, -π, π}, Frame -> True, Exclusions -> All, PlotLabel -> "k=" <> ToString[k], PlotRange -> {{-5, 5}, {-5, 5}}], {k, 1, 6}]Function Properties (13)
The real domain of Sec:
FunctionDomain[Sec[x], x]FunctionDomain[Sec[z], z, Complexes]Sec achieves all real values except the open interval
:
FunctionRange[Sec[x], x, y]Sec is a periodic function with a period
:
FunctionPeriod[Sec[x], x]Sec is an even function:
Sec[-x]Sec has the mirror property
:
FullSimplify[Sec[Conjugate[z]] == Conjugate[Sec[z]]]Sec is not an analytic function:
FunctionAnalytic[Sec[x], x]FunctionMeromorphic[Sec[x], x]Sec is monotonic in a specific range:
FunctionMonotonicity[Sec[x], x]FunctionMonotonicity[{Sec[x], 0 < x < π / 2}, x]Sec is not injective:
FunctionInjective[Sec[x], x]Plot[{Sec[x], 2}, {x, -2π, 2π}]Sec is not surjective:
FunctionSurjective[Sec[x], x]Plot[{Sec[x], .5}, {x, -2π, 2π}]Sec is neither non-negative nor non-positive:
FunctionSign[Sec[x], x]It has both singularity and discontinuity when x is a multiple of π/2:
FunctionSingularities[Sec[x], x]FunctionDiscontinuities[Sec[x], x]FunctionConvexity[Sec[x], x]It is convex for x in [-1.5,1.5]:
FunctionConvexity[{Sec[x], -1.5 < x < 1.5}, x]Plot[Sec[x], {x, -1.5, 1.5}]TraditionalForm formatting:
Sec[z]//TraditionalFormDifferentiation (3)
D[Sec[x], x]Table[D[Sec[x], {x, n}], {n, 1, 4}]Plot[Evaluate[%], {x, -π, π}, PlotLegends -> {"First Derivative", "Second Derivative", "Third Derivative", "Fourth Derivative"}]D[Sec[x], {x, n}]Integration (3)
Series Expansions (4)
Find the Taylor expansion using Series:
Series[Sec[x], {x, 0, 8}]Plot the first three approximations for Sec around
:
terms = Normal@Table[Series[Sec[x], {x, 0, m}], {m, 2, 6, 2}];
Plot[{Sec[x], terms}, {x, -π / 2, π / 2}, PlotRange -> {0, 4}]General term in the series expansion of Sec:
SeriesCoefficient[Sec[x], {x, 0, n}]Fourier series of Sec:
FourierSeries[Sec[x], x, 1]Sec can be applied to power series:
Sec[(π/2) + x + (x^2/2) + (x^3/3) + O[x]^4]Function Identities and Simplifications (6)
Sec of a double angle:
Expand[Sec[2x] , Trig -> True]Sec of a sum:
Expand[Sec[x + y] , Trig -> True]Convert multiple‐angle expressions:
TrigExpand[Sec[4x]]TrigReduce[%]Convert sums of trigonometric functions to products:
TrigFactor[Sec[x] + Sec[y]]Expand assuming real variables
and
:
ComplexExpand[Sec[x + I y]]Convert to complex exponentials:
TrigToExp[Sec[z]]Function Representations (4)
Representation through Sin:
Simplify[1 / Sin[(Pi/2) - x]]Representation through Bessel functions:
Simplify[1 / Sqrt[( π x/2)] / BesselJ[-(1/2), x]]Simplify[1 / Sqrt[( π I x/2)] / BesselI[-(1/2), I x]]Representation through SphericalHarmonicY:
Simplify[Sqrt[3 / (4 π)] / SphericalHarmonicY[1, 0, θ, 0]]Representation in terms of MeijerG:
1 / MeijerGReduce[Cos[x], x]Activate[%]Applications (4)
Generate a plot with poles removed:
Plot[Sec[x], {x, 0, 2Pi}, Exclusions -> Cos[x] == 0]Generate a plot over the complex argument plane:
Plot3D[Re[Sec[x + I y]], {x, 0, 2Pi}, {y, -1, 1}]Solve a differential equation:
DSolve[y''[x]y[x] - 2y'[x]^2 - y[x]^2 == 0, y[x], x]Pursuit curve in the reference frame of the predator with prey moving half as fast along a line:
s = DSolve[{ℓ'[ϕ] == ℓ[ϕ] (Sin[ϕ] + 2) / Cos[ϕ], ℓ[0] == 2}, ℓ[ϕ], ϕ]//FullSimplifyPolarPlot[Evaluate[ℓ[ϕ] /. s], {ϕ, -π / 4, π / 4}, AspectRatio -> 1]Properties & Relations (11)
Basic parity and periodicity properties of the secant function get automatically applied:
Sec[x + Pi]Sec[-x]Sec[I x]1 / Sec[x]Use TrigFactorList to factor Sec into Sin and Cos:
1 / Cos[x]TrigFactorList[Sec[x]]Complicated expressions containing trigonometric functions do not autosimplify:
Sec[z - π / 3] Sec[π / 3 + z] + Sec[z - π / 3] Sec[z] + Sec[z] Sec[π / 3 + z]Simplify[%]Sec[Conjugate[z]] - Conjugate[Sec[z]]FullSimplify[%]Evaluate under additional assumptions:
Sec[-x + k Pi]Refine[%, k∈Integers]Compositions with the inverse functions:
{Sec[ArcSec[z]], Sec[2ArcSec[z]], Sec[3ArcSec[z]]}FunctionExpand[%]//TogetherSec[1] == SecDegrees[180 / π]//SimplifySolve a trigonometric equation:
Reduce[Sec[z]^2 - Sec[z + Pi / 4] == 1, z]Reduce[Sec[α x + β] == 0, x]Reduce[1 / Sec[α x + β] == 0, x]Numerically solve a transcendental equation:
FindRoot[Sec[z]^2 + 3 Sec[z + Pi / 6] + z == 4, {z, 2}]Sec is automatically returned as a special case for many mathematical functions:
{1 / BesselJ[-(1/2), z], 1 / MathieuC[1, 0, z], JacobiDC[z, 0], JacobiNC[z, 0], 1 / HypergeometricPFQ[{}, {(1/2)}, -(z^2/4)], 1 / MeijerG[{{}, {}}, {{-(1/2)}, {0}}, (z^2/4)]}Calculate residue symbolically and numerically:
Table[Residue[Sec[z]^k, {z, (π/2)}], {k, 10}](1/2π I)NIntegrate[Sec[z], {z, (π/2) - (1/4), (π/2) - (I/4), (π/2) + (1/4), (π/2) + (I/4), (π/2) - (1/4)}]Possible Issues (5)
Machine-precision input is insufficient to give a correct answer:
Sec[10. ^ 32]With exact input, the answer is correct:
N[Sec[10 ^ 30], 32]A larger setting for $MaxExtraPrecision is needed:
N[Sec[10 ^ 100], 20]//QuietBlock[{$MaxExtraPrecision = 1000}, N[Sec[10 ^ 100], 20]]For arguments with imaginary part too large, the result cannot be represented by a computer:
N[Sec[10000000000000000 I], 20]//QuietThe precision of the output can be much smaller or larger than the precision of the input:
Sec[1.5707963267948966192213216916397514421]Sec[2 1.5707963267948966192213216916397514421]In TraditionalForm, parentheses are needed around the argument:
sec xsec(x)Neat Examples (6)
Integrate[Sec[x], x]∫Sin[b z] Sec[c z]ⅆz∫z^2 E^b zSec[a z]ⅆzUnderoverscript[∏, k = 1, n - 1] Sec[z + (k π/n)]Plot Sec at integer points:
ArrayPlot[Table[ArcTan[Abs[Sec[x y]]], {x, -20, 20}, {y, -20, 20}]]Give a nested radical representation:
Sec[(π/2^12)]//FunctionExpandGenerate the Sec function from integrals and sums:
π Underoverscript[∑, k = 0, ∞]((-1)^k (2 k + 1)/(k + (1/2))^2 π^2 - z^2) // Simplify(2/π) Integrate[(t^(2 z/π)/t^2 + 1), {t, 0, ∞}, Assumptions -> π + 2 Re[z] > 0 && 2 Re[z] < π]Sec[n] is a transcendental number at nonzero integer n:
Element[Sec[1], Algebraics]Tech Notes
Related Guides
Related Links
History
Introduced in 1988 (1.0) | Updated in 1996 (3.0) ▪ 2021 (13.0)
Text
Wolfram Research (1988), Sec, Wolfram Language function, https://reference.wolfram.com/language/ref/Sec.html (updated 2021).
CMS
Wolfram Language. 1988. "Sec." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/Sec.html.
APA
Wolfram Language. (1988). Sec. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Sec.html
BibTeX
@misc{reference.wolfram_2026_sec, author="Wolfram Research", title="{Sec}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/Sec.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_sec, organization={Wolfram Research}, title={Sec}, year={2021}, url={https://reference.wolfram.com/language/ref/Sec.html}, note=[Accessed: 13-June-2026]}