# Dependency of parameter to find maximum vanishes after simplification

EDIT: It turns out I just made a dumb mistake:

Simplify[Exp[x^2]*2^n*Pi*D[maxdist[n,x]/n*(1+Erf[x/Sqrt])^(2-n),x]]

A portion of my "factor" is actually inside the derivative. Thanks to everyone who helped!

I'm using Mathematica to try to solve: https://math.stackexchange.com/questions/1700486

The probability distribution function (PDF) of the maximum of n standard normally distributed variables is:

(2^(1/2 - n)*n*(1 + Erf[x/Sqrt])^(-1 + n))/(E^(x^2/2)*Sqrt[Pi])


To find the mode, I take the derivative and set equal to 0. The "raw" derivative is:

(2^(1 - n)*(-1 + n)*n*(1 + Erf[x/Sqrt])^(-2 + n))/(E^x^2*Pi) -
(2^(1/2 - n)*n*x*(1 + Erf[x/Sqrt])^(-1 + n))/(E^(x^2/2)*Sqrt[Pi])


and Simplify will reduce it to:

-((n*(1 + Erf[x/Sqrt])^(-2 + n)*(2 - 2*n + E^(x^2/2)*Sqrt[2*Pi]*x +
E^(x^2/2)*Sqrt[2*Pi]*x*Erf[x/Sqrt]))/(2^n*E^x^2*Pi))


Since I only need to see when this value is $0$, I can multiply it by anything that's not $0$ (or undefined), in particular:

Exp[x^2] 2^n Pi/n (1 + Erf[x/Sqrt])^(2 - n)


Multiplying the simplified derivative by that quantity yields:

2^n E^x^2 Pi (2^(1 - n)/(E^x^2 Pi) - (2^(1/2 - n) x (1 + Erf[x/Sqrt])) /
(E^(x^2/2) Sqrt[Pi]))


Simplifying again, we have:

2 - E^(x^2/2) Sqrt[2 Pi] x - E^(x^2/2) Sqrt[2 Pi] x Erf[x/Sqrt]


The problem? This value no longer depends on $n$.

However, graphing the PDF for various values of $n$ shows that the mode changes: ## 1 Answer

I wonder if your calculations have gone astray somewhere. I seem to get a different result.

Below pdf is your expression for the PDF you are working with, factor is the non-zero expression by which you want to multiply your derivative:

pdf = (2^(1/2 - n)*n*(1 + Erf[x/Sqrt])^(-1 + n))/(E^(x^2/2)*Sqrt[Pi]);
factor = Exp[x^2]*2^n*Pi/n*(1 + Erf[x/Sqrt])^(2 - n);


Calculating D[pdf, x] // Simplify agrees with your raw and simplified results in the question. However, multiplying by your factor and simplifying did not remove the dependence on n:

D[pdf, x] factor // Simplify Solve[D[pdf, x] factor == 0, n] • I was about to write an answer, but I'll leave this comment instead: have a look at FullSimplify[D[PDF[OrderDistribution[{NormalDistribution[], n}, n], x], x]]. – J. M.'s torpor Mar 20 '16 at 16:25
• Thanks, @MarcoB! As a minor note, finding the value of n for where the derivative is 0 is quite interesting, but I think I need the solution for x to find the mode :) – user1722 Mar 20 '16 at 17:27
• Something like With[{n = 25}, x /. FindRoot[-2 + 2 n + Exp[x^2/2] Sqrt[2 π] x (-2 + Erfc[x/Sqrt]), {x, -Sqrt InverseErfc[2^(1 - 1/n)]}]] then, @barry? – J. M.'s torpor Mar 20 '16 at 17:47
• Yes, that's what I had been doing, and was hoping to find a closed form solution, but no luck, alas. github.com/barrycarter/bcapps/blob/master/STACK/bc-prob-max.m for the morbidly curious :) – user1722 Mar 20 '16 at 17:53