LegendreQ
Details
- Mathematical function, suitable for both symbolic and numerical manipulation.
- For integers n and m, explicit formulas are generated.
- The Legendre functions satisfy the differential equation
. - LegendreQ[n,m,a,z] gives Legendre functions of type a. The default is type 1.
- LegendreQ of types 1, 2 and 3 are defined in terms of LegendreP of these types, and have the same branch cut structure and properties described for LegendreP.
- For certain special arguments, LegendreQ automatically evaluates to exact values.
- LegendreQ can be evaluated to arbitrary numerical precision.
- LegendreQ automatically threads over lists.
- LegendreQ can be used with Interval and CenteredInterval objects. »
Examples
open all close allBasic Examples (6)
LegendreQ[1 / 3, 0.5]Compute the 5
Legendre function of the second kind:
LegendreQ[5, x]Plot over a subset of the reals:
Plot[ LegendreQ[1 / 5, x], {x, -1, 1}]Plot over a subset of the complexes:
ComplexPlot3D[LegendreQ[1 / 2, z], {z, -2 - 2I, 2 + 2I}, PlotLegends -> Automatic]Series expansion at the origin:
Series[LegendreQ[1 / 2, x], {x, 0, 2}]Asymptotic expansion at Infinity:
Series[LegendreQ[1 / 2, x], {x, ∞, 3}]//Normal//FullSimplifyScope (42)
Numerical Evaluation (6)
Evaluate numerically at fixed points:
{LegendreQ[2, 0.5], LegendreQ[2, 2, 0.5], LegendreQ[1 / 2, 0.5]}N[LegendreQ[3 / 2, 1 / 2], 50]The precision of the output tracks the precision of the input:
LegendreQ[3 / 2, 0.5000000000000000000000000000]Evaluate for complex arguments:
LegendreQ[1 - I, 2 + I, 0.5]Evaluate LegendreQ efficiently at high precision:
LegendreQ[3 / 2, 0.5`300]//TimingLegendreQ[3 / 2, 0.5`1000];//TimingCompute worst-case guaranteed intervals using Interval and CenteredInterval objects:
LegendreQ[1 / 2, 2 / 3, Interval[{0.4, 0.5}]]LegendreQ[1 / 2, CenteredInterval[2, 1 / 100]]LegendreQ[1 / 2, 2 / 3, CenteredInterval[3 / 4, 1 / 100]]Or compute average-case statistical intervals using Around:
LegendreQ[2, Around[1 / 3, 0.5]]Compute the elementwise values of an array:
LegendreQ[1, {{5 / 6, 0}, {1 / 2, -1 / 3}}]Or compute the matrix LegendreQ function using MatrixFunction:
MatrixFunction[LegendreQ[2, #]&, {{5 / 6, 0}, {1 / 2, -1 / 3}}]Specific Values (5)
LegendreQ[n, 0]//FunctionExpandLegendreQ[0, x]Find a local maximum as a root of
:
xmax = NSolve[D[LegendreQ[5, x], x] == 0 && 0.2 < x < 0.7, x][[1, 1, 2]]Plot[LegendreQ[5, x], {x, -1, 1}, Epilog -> Style[Point[{xmax, LegendreQ[5, xmax]}], PointSize[Large], Red]]Compute the associated Legendre function of the second kind
:
LegendreQ[3, 1, x]//FullSimplifyDifferent LegendreQ types give different symbolic forms:
Table[LegendreQ[1, 1, a, z], {a, 1, 3}]//FunctionExpand//FullSimplifyVisualization (3)
Plot the LegendreQ function for various degrees:
Plot[{LegendreQ[1, x], LegendreQ[2, x], LegendreQ[3, x], LegendreQ[4, x]}, {x, -1, 1}]ComplexContourPlot[Re[LegendreQ[4, z]], {z, -1 - I, 1 + I}, IconizedObject[«PlotOptions»]]ComplexContourPlot[Im[LegendreQ[4, z]], {z, -1 - I, 1 + I}, IconizedObject[«PlotOptions»]]Type 2 and 3 Legendre functions have different branch cut structures:
Plot3D[Im[LegendreQ[1, 1, 2, x - I y]], {x, -1.5, 1.5}, {y, -1.5, 1.5}, Exclusions -> {{y == 0, Abs[x] > 1}}]Plot3D[Im[LegendreQ[1, 1, 3, x - I y]], {x, -1.5, 1.5}, {y, -1.5, 1.5}, Exclusions -> {{y == 0, Abs[x] < 1}}]Function Properties (12)
is defined for
as long as
is not a negative integer:
FunctionDomain[LegendreQ[m, z], z]In the complex plane, it is defined for
as long as
is not a negative integer:
FunctionDomain[LegendreQ[m, z], z, Complexes]The range for Legendre functions of integer order:
{FunctionRange[LegendreQ[1, x], x, y], FunctionRange[LegendreQ[2, x], x, y]}A Legendre function of an odd order is even:
LegendreQ[3, -x] == LegendreQ[3, x]//SimplifyA Legendre function of an even order is odd:
LegendreQ[4, -x] == -LegendreQ[4, x]//SimplifyLegendre function has the mirror property
:
FullSimplify[LegendreQ[2, Conjugate[z]] == Conjugate[LegendreQ[2, z]], -1 < z < 1]LegendreQ is not an analytic function:
FunctionAnalytic[LegendreQ[2, x], x]FunctionMeromorphic[LegendreQ[2, x], x]
is neither non-decreasing nor non-increasing in
for positive integer
:
Table[FunctionMonotonicity[{LegendreQ[m, x], -1 < x < 1}, x], {m, 4}]For
and noninteger
, it is increasing:
Table[FunctionMonotonicity[{LegendreQ[m, x], -1 < x < 1}, x, StrictInequalities -> True], {m, {0, 1 / 2}}]
is not injective in
for positive integer
:
Table[FunctionInjective[{LegendreQ[m, x], -1 < x < 1}, x], {m, 4}]For
and noninteger
, it is injective:
Table[FunctionInjective[{LegendreQ[m, x], -1 < x < 1}, x], {m, {0, 1 / 2}}]Plot[{LegendreQ[0, x], LegendreQ[1, x], LegendreQ[2, x], .5}, {x, -1, 1}]
is surjective in
for non-negative even
:
Table[FunctionSurjective[{LegendreQ[m, x], -1 < x < 1}, x], {m, 0, 6, 2}]It is not surjective for other values of
:
Table[FunctionSurjective[{LegendreQ[m, x], -1 < x < 1}, x], {m, {1 / 2, 1, 3 / 2, 3}}]Plot[{LegendreQ[0, x], LegendreQ[2, x], LegendreQ[1 / 2, x], LegendreQ[1, x], -3}, {x, -1, 1}, PlotRange -> 5]LegendreQ is neither non-negative nor non-positive:
FunctionSign[LegendreQ[2, x], x]LegendreQ has both singularity and discontinuity in (-∞,-1] and [1,∞):
FunctionSingularities[LegendreQ[2, x], x]FunctionDiscontinuities[LegendreQ[2, x], x]
is neither convex nor concave for most values of
:
Table[FunctionConvexity[{LegendreQ[m, x], -1 < x < 1}, x], {m, 5}]Differentiation (3)
D[LegendreQ[n, x], x]derivs = Table[D[LegendreQ[n, x], {x, l}], {l, 1, 4}]//FullSimplifyPlot[Evaluate[derivs /. n -> 5], {x, -1, 1}, PlotRange -> {-110, 110}, PlotLegends -> {"First Derivative", "Second Derivative", "Third Derivative", "Fourth Derivative"}]D[LegendreQ[n, x], {x, l}]Integration (3)
Integrate[LegendreQ[1, x], x]//FullSimplifyDefinite integral of the odd integrand
over the interval centered at the origin is 0:
Integrate[LegendreQ[2, x], {x, -1, 1}]Definite integral of the even integrand
over the interval centered at the origin:
Integrate[LegendreQ[3, x], {x, -1, 1}]This is twice the integral over half the interval:
Integrate[LegendreQ[3, x], {x, 0, 1}]Series Expansions (4)
Series[LegendreQ[n, x], {x, 0, 3}]//FullSimplifyPlot the first three approximations for
at
:
terms = Normal@Table[Series[LegendreQ[6, x], {x, 0, m}], {m, 1, 5, 2}];
Plot[{LegendreQ[6, x], terms}, {x, -1, 1}, PlotRange -> {-2, 2}]General term in the series expansion of
:
SeriesCoefficient[LegendreQ[n, x], {x, 0, l}]Taylor expansion for the associated Legendre function
:
Series[LegendreQ[n, m, x], {x, 0, 1}]//FullSimplifyLegendreQ can be applied to a power series:
LegendreQ[0, Cos[x] + O[x] ^ 6]Function Identities and Simplifications (2)
Expand LegendreQ of integer or half-integer parameters into simpler functions:
FunctionExpand[LegendreQ[3, 1, 3, x]]//FullSimplifyFunctionExpand[LegendreQ[3 / 2, 1 / 2, 3, x]]//FullSimplify(n + 1) LegendreQ[n, z] == (2 n + 3) z LegendreQ[n + 1, z] - (n + 2) LegendreQ[n + 2, z]//FullSimplifyFunction Representations (4)
LegendreQ can be expressed as a DifferentialRoot:
DifferentialRootReduce[LegendreQ[n, x], x]Associated Legendre function in terms of the angular spheroidal function:
SpheroidalQS[n, m, 0, z]//FullSimplifyAssociated Legendre function in terms of Legendre function of type
:
LegendreQ[n, m, z] == LegendreQ[n, m, 2, z]//FullSimplifyTraditionalForm formatting:
LegendreQ[n, x]//TraditionalFormLegendreQ[n, m, x]//TraditionalFormGeneralizations & Extensions (2)
Different LegendreQ types give different symbolic forms:
LegendreQ[1, 1, 1, z]LegendreQ[1, 1, 2, z]//FunctionExpandLegendreQ[1, 1, 3, z]//FunctionExpandTypes 2 and 3 have different branch cut structures:
Plot3D[Im[LegendreQ[1, 1, 2, x - I y]], {x, -1.5, 1.5}, {y, -1.5, 1.5}, Exclusions -> {{y == 0, Abs[x] > 1}}]Plot3D[Im[LegendreQ[1, 1, 3, x - I y]], {x, -1.5, 1.5}, {y, -1.5, 1.5}, Exclusions -> {{y == 0, Abs[x] < 1}}]Applications (4)
Angular momentum eigenfunctions:
DSolve[Sin[θ] D[Sin[θ] f'[θ], θ] - m^2f[θ] == -λ(λ + 1)Sin[θ]^2f[θ], f[θ], θ]RSolve[ (n + m)f[n - 1] + (n - m + 1)f[n + 1] == (n + 1 / 2)f[n], f[n], n]The Pöschl–Teller potential is a special class of potentials for which the one-dimensional Schrödinger equation can be solved in terms of special functions.
Find quantum eigenfunctions for the modified Pöschl–Teller potential:
DSolve[-f''[x] - j(j + 1) / Cosh[x] ^ 2 f[x] == -n ^ 2 f[x], f[x], x]An n-point Gaussian quadrature rule is based on the roots of the n
order Legendre polynomial. Compute the nodes and weights of an n-point Gaussian quadrature rule:
n = 5;
lp[x_] = LegendreP[n, x];
gaussNodes = x /. NSolve[lp[x], x]w1 = x |-> (2/n LegendreP[n - 1, x]lp'[x]);
gaussWeights = w1[gaussNodes]Use the n-point Gaussian quadrature rule to numerically evaluate an integral:
fun[x_] := (1/1 / 100 + (x - 3 / 10)^2) + (1/1 / 25 + (x - 9 / 10)^2) - 6a = 1 / 2;b = 1;
est1 = ((b - a/2)gaussWeights).Map[fun, Rescale[gaussNodes, {-1, 1}, {a, b}]]The Kronrod extension of a Gaussian quadrature rule adds n+1 points and reuses the n nodes from Gaussian quadrature, resulting in an integration rule with 2n+1 points. The additional n+1 nodes can be obtained as the roots of a polynomial constructed from the asymptotic expansion of the Legendre function of the second kind (the Stieltjes polynomial):
sp[x_] = Normal[Quiet[Series[(4^n Beta[n + 1, n + 1]/LegendreQ[n, 0, 3, x]), {x, ∞, 0}], Series::sbyc]]Compute the Gauss–Kronrod nodes and weights:
kronrodNodes = x /. NSolve[sp[x], x];
gkNodes = Riffle[kronrodNodes, gaussNodes]w2 = x |-> (2^2n + 1n!^2/(2n + 1)!)(1/lp[x]sp'[x]);
w3 = x |-> (2^2n + 1n!^2/(2n + 1)!)(1/lp'[x]sp[x]);
gkWeights = Riffle[w2[kronrodNodes], gaussWeights + w3[gaussNodes]]Use the (2n+1)-point Gauss–Kronrod rule to numerically evaluate an integral:
est2 = ((b - a/2)gkWeights).Map[fun, Rescale[gkNodes, {-1, 1}, {a, b}]]The difference between the results of the Gauss–Kronrod rule and the Gaussian rule can be used as an error estimate:
est2 - est1Compare the result of the Gauss–Kronrod rule with the result from NIntegrate:
est2 - NIntegrate[fun[x], {x, a, b}]Properties & Relations (2)
LegendreQ can be expressed as a DifferenceRoot:
DifferenceRootReduce[LegendreQ[k, y], k]DifferenceRootReduce[LegendreQ[k, y, z], k]The generating function for LegendreQ:
GeneratingFunction[LegendreQ[n, k], n, x]Tech Notes
Related Links
History
Introduced in 1988 (1.0) | Updated in 1996 (3.0) ▪ 2021 (13.0) ▪ 2022 (13.1)
Text
Wolfram Research (1988), LegendreQ, Wolfram Language function, https://reference.wolfram.com/language/ref/LegendreQ.html (updated 2022).
CMS
Wolfram Language. 1988. "LegendreQ." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/LegendreQ.html.
APA
Wolfram Language. (1988). LegendreQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/LegendreQ.html
BibTeX
@misc{reference.wolfram_2026_legendreq, author="Wolfram Research", title="{LegendreQ}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/LegendreQ.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_legendreq, organization={Wolfram Research}, title={LegendreQ}, year={2022}, url={https://reference.wolfram.com/language/ref/LegendreQ.html}, note=[Accessed: 13-June-2026]}