Legendre Q(n,x) function coefficients in terms of P(n,x) coefficients

Empirically, the Legendre functions of second kind, $Q_n(x)$, appear to be of form $$Q_n(x)=\frac{P_n(x)}{2} \cdot\ln(\frac{1+x}{1-x})+p_n(x),$$ with $P_n(x)$ the Legendre polynomials of first kind and $p_n(x)$ some rational polynomial of degree $n-1$.

This observation came up with my current reimplementation of $Q_n(x)$ for the Sage CAS. Probably it has to do with the $Q_n(x)$ satisfying the same recurrence as the $P_n(x)$? Would it be possible to give the $p_n(x)$ in terms of $P_n(x)$? It would make this implementation much faster. Also, I haven't seen such a form in the standard literature, so this may be even new (though unsurprising).

Update: as the answer shows the form is not new. However, the $p_n=W_n$ satisfy the recurrence $$nW_n = (2nx-x)W_{n-1} - (n-1)W_{n-2}, W_0=0, W_1=1,$$ which is not in the NIST handbook.

• The formula is not new, a quick internet search produces many references, for example: mathworld.wolfram.com/LegendreFunctionoftheSecondKind.html Sep 6, 2014 at 18:38
• That reference does not show such a formula. Where did you see it?
– rwst
Sep 6, 2014 at 18:53
• Maybe this is a misunderstanding about what "such a form" means, but I was referring to the first few formulae on the linked page. Sep 6, 2014 at 18:56
• They show the first 5 Q(n,x) as example. This question is about the general form which needs a proof, and a form for the p(n,x) term. Is the question unclear? How can it be improved?
– rwst
Sep 6, 2014 at 19:48

The formular you search for is really known. It is on p. 360 of the NIST Handbook of Mathematical Functions, formulas (14.7.2)--(14.7.7). $p_n(x)$ is in fact an explicit polynomial (not rational) with coefficients depending on $\psi$--function.