Use the Probability Generating Function for Involutions:
$P_{x_n}(z) = \prod_{i=1}^n\frac{1+z+z^2+...+z^{i-1}}{i}$
To Calculate the Variance of Involutions where:
$Variance \space X_n = P_{x_n}''(1) + P_{x_n}'(1) - (P_{x_n}'(1))^2$
Firstly, I have that
$P_{x_n}'(z)=\sum_{i=1}^n(\prod_{j\neq i}\frac{1+z+...+z^{j-1}}{j})(\frac{1+2z+3z^2+...+(i-1)z^{i-2}}{i})$
as established in Derivative of a product $P_{x_n}(z) = \prod_{i=1}^n\frac{1+z+z^2 +...+z^{i-1}}{i} $
But now for the second derivative (and please correct me if I made a mistake)
$P_{x_n}''(z)=\sum_{i=1}^n(\prod_{j\neq i}\frac{1+z+...+z^{j-1}}{j})(\frac{2+6z+...+(i-1)(i-2)z^{i-3}}{i}) + \sum_{i=1}^n \sum_{j\neq i}(\prod_{k\neq j}\frac{1+z+...+z^{k-1}}{k})(\frac{1+2z+3z^2+...+(j-1)z^{j-2}}{j})(\frac{1+2z+3z^2+...+(i-1)z^{i-2}}{i}) $
setting $z=1$ we obtain
$P_{x_n}''(1)=\sum_{i=1}^n(\frac{2+6+...+(i-1)(i-2)}{i}) + \sum_{i=1}^n \sum_{j\neq i}(\frac{1+2+3+...+(j-1)}{j})(\frac{1+2+3+...+(i-1)}{i}) $
Now for triangular numbers, $2,6,12,20,...$ we have that
$\space 2+6+12+20+...+(n-1)n = \frac{n(n+1)(n+2)}{3}$
and since $\sum_{i=1}^n i = \frac{n(n+1)}{2}$
$P_{x_n}''(1)=\sum_{i=1}^n(\frac{(i-1)i(i+1)}{3i}) + \sum_{i=1}^n \sum_{j\neq i}(\frac{j-1}{2})(\frac{i-1}{2}) $
which simplifies to
$P_{x_n}''(1)=\frac{1}{3}\sum_{i=1}^n((i-1)(i+1)) + \sum_{i=1}^n \sum_{j\neq i}(\frac{j-1}{2})(\frac{i-1}{2}) $
$P_{x_n}''(1)=\frac{1}{3}\sum_{i=1}^{n}(i^2-1) + \sum_{i=1}^n \sum_{j\neq i}(\frac{j-1}{2})(\frac{i-1}{2}) $
and since $\sum_{i=1}^ni^2 =\frac{n(n+1)(2n+1)}{6}$
$P_{x_n}''(1)=\frac{1}{3}(\frac{n(n+1)(2n+1)}{6} - n) + \sum_{i=1}^n \sum_{j\neq i}(\frac{j-1}{2})(\frac{i-1}{2}) $
my question is how do I simplify further? and was my differentiation correct?
Any help would be greatly appreciated.
update:
We get that
$P_{x_n}''(1)=\frac{1}{3}(\frac{n(n+1)(2n+1)}{6} - n) + \sum_{i=1}^n \sum_{j=1}^n(\frac{j-1}{2})(\frac{i-1}{2}) - \sum_{i=1}^n\frac{(i-1)^2}{4} $
and this simplifies to
$P_{x_n}''(1)=\frac{1}{3}(\frac{n(n+1)(2n+1)}{6} - n) + \frac{n(n-1)}{4}\frac{n(n-1)}{4} - \frac{1}{4}(\frac{(n-1)n(2(n-1)+1)}{6}) $
Now using the formula for variance,
$Var \space X_n = P_{X_n}''(1)+P_{X_n}'(1)-(P_{X_n}'(1))$
where $P_{X_n}'(1)$ is obtained from Derivative of a product $P_{x_n}(z) = \prod_{i=1}^n\frac{1+z+z^2 +...+z^{i-1}}{i} $
We get that
$Var \space X_n = \frac{1}{3}(\frac{n(n+1)(2n+1)}{6} - n) + \frac{n(n-1)}{4}\frac{n(n-1)}{4} - \frac{1}{4}(\frac{(n-1)n(2(n-1)+1)}{6}) + \frac{n(n-1)}{4} - (\frac{n(n-1)}{4})^2$
and hence
$Var \space X_n = \frac{2n^3+39n^2-42n}{72}$ which is not the correct answer
however if you instead take
$Var \space X_n = \frac{1}{3}(\frac{n(n+1)(2n+1)}{6} - n) + \frac{n(n-1)}{4}\frac{n(n-1)}{4} - \frac{1}{4}(\frac{(n-1)n(2(n-1)+1)}{6}) - \frac{n(n-1)}{4} - (\frac{n(n-1)}{4})^2$ with a $- \frac{n(n-1)}{4}$
you obtain
$Var \space X_n = \frac{2n^3+3n^2-5n}{72} = \frac{(n-1)n(2n+5)}{72}$ which is the correct answer.
Where am I making a mistake? Did I somehow leave out a term of $-2\frac{n(n-1)}{4}$
The result I got does not seem to agree with yours, but I wasn't able to go through your computation because I used a different approach, via logarithmic differentiation: $$P_{x_n}(z) = \prod_{i=1}^n \frac{1-z^i}{i(1-z)} = \exp \Bigl( -\log n! - n \log (1-z) + \sum_{i=1}^n \log (1-z^i) \Bigr) = \exp p_{x_n}(z),$$ where $$p_{x_n}(z) = -\log n! - n \log(1-z) + \sum_{i=1}^n \log(1-z^i).$$ We also note that $P_{x_n}(1) = 1$, from the original definition. Then $$\begin{align*} P'(z) &= p'(z) P(z), \\ P''(z) &= p''(z) P(z) + p'(z) P'(z) \\ &= (p''(z) + (p'(z))^2)P(z).\end{align*}$$ Thus, $$P''(1) - (P'(1))^2 = p''(1).$$ Calculating the first and second derivatives is easy: $$\begin{align*} p'_{x_n}(z) &= \frac{n}{1-z} - \sum_{i=1}^n \frac{iz^{i-1}}{1-z^i}; \\ p''_{x_n}(z) &= \frac{n}{(1-z)^2} - \sum_{i=1}^n \frac{iz^{i-2}(i-1+z^i)}{(1-z^i)^2}. \end{align*}$$ Evaluating the latter at $z = 1$, however, is a less trivial task. Consider instead the function $$a_i(z) = \frac{1}{(1-z)^2} - \frac{iz^{i-2}(i-1+z^i)}{(1-z^i)^2}.$$ Then $p''(z) = \sum_{i=1}^n a_i(z)$. Some computation (I leave it to you) gives $$\lim_{z \to 1} a_i(z) = \frac{(i-1)(i-5)}{12},$$ from which it follows that $$p''_{x_n}(1) = \frac{1}{72} (n-1) n (2 n-13).$$