# If $f(x)$ is a unimodal probability density function, how can I show that its mode is at $f'(x)=0$?

If the function $f(x)$ is continuous and a probability density function (PDF), how can I show that its mode is at $f'(x)=0$?

• As per Christoph's answer, this does not hold. Not even if $f$ is everywhere differentiable (it could have a vanishing derivative at a minimum at the extremes of its domain of definition). Oct 8, 2015 at 11:53
• @Stephan The logic of the question is a little different. It does not ask to show that all points of vanishing derivative are modes, but only that the derivative at a mode must vanish. (The only way that can fail to be true is when $f$ is not differentiable at its mode.)
– whuber
Oct 8, 2015 at 15:01
• you might read it either way, I guess: show that its mode is at $f'(x)=0$ seems compatible with the aim to show the (false, as we discussed) implication $f'(x)=0\Rightarrow\text{a mode}$ Oct 8, 2015 at 16:08

If it's only continuous but not differentiable at the mode, you can't. Consider the Laplace distribution. • Also see en.wikipedia.org/wiki/Uniform_distribution_(continuous)#/media/…, the density for the continuous uniform distribution on [a, b]. There are points outside [a, b] where df/dx = 0. Oct 8, 2015 at 12:23
• Same comment as above, but better example: en.wikipedia.org/wiki/Triangular_distribution#/media/…, the triangular distribution (can be generated as the sum of two iid uniforms). Oct 8, 2015 at 12:40
• Better than my first comment, but not better than your answer! My comments were intended as additional examples for the OP, not as contradicting your answer. Oct 8, 2015 at 13:16
• @Adrian The uniform distribution is not a valid counterexample, because no version of its density can be continuous, as required by the question.
– whuber
Oct 8, 2015 at 14:59

Find the maximum value. The Laplace distribution is defined piece-wise, and not smooth at the mode, which is at the piece-wise common point (A.K.A., corner point), and such a common, junctional corner point in a piece-wise defined function has no general continuity guarantee of either the separate piecewise defined functions' amplitudes nor any of their derivatives. The mode for a Laplace distribution occurs at $\frac{e^{-\frac{x-\mu }{\beta }}}{2 \beta }=\frac{e^{-\frac{\mu -x}{\beta }}}{2 \beta }\to x=\mu$, because $f(x=\mu)=\frac{1}{2 \beta }$ is the maximum value of $f$. Of course there are continuous functions that are differentiable nowhere, and differentiability is not a requirement. Thus, the general answer is simply find the maximum of the pdf. This can be done in closed form as above for something as simple as the Laplace distribution. It can be done numerically for nice smooth functions using derivatives example by referring to How to prevent newton's method from finding maxima? and altering it to avoid minima. Or, more generally for nasty functions using a canned routine like FindMaximum in Mathematica with a global search routine like RandomSearch.

@Glen_b and @Dougal, thanks for the help, anything further @me.

• The mode is not at a boundary for the Laplace (which is defined - and continuous - over the whole real line). It's not cheating but a perfectly valid counterexample. If people don't account for such possibilities, they will be wrong when they try to make general statements. I suspect you misunderstand what a boundary is in this case (an example of a case where you'd worry about the mode being at a boundary would be the case of an ordinary exponential distribution at 0). Mar 26, 2017 at 9:01
• @Carl If you define the Laplace distribution piecewise for the negative and positive reals, then sure, the mode 0 is at a boundary of each sub-part. But in the standard way of thinking about it, the Laplace density is just a function $\frac12 \exp(- \lvert x \rvert )$ defined on $\mathbb R$, and $0$ is in no way a boundary point of $\mathbb R$. Mar 26, 2017 at 16:45
• @Carl In this case we're talking about a boundary point of the domain of the variable. The random variable is defined over the whole real line, so for the Laplace, the set $A$ in the definition you quote is $\mathbb{R}$. Mar 26, 2017 at 17:11
• There's only a junction there because you chose to make it one; that's not necessary to anything. It doesn't matter how you want to split a domain up, that doesn't make it a boundary. The domain is the union of the two pieces you split it into and if you look back at the definition of boundary you gave, and apply it, you can see there's no boundary point there. I don't propose to keep arguing with you, though. Your answer is wrong, I've explained why, and you refuse to change it. That's up to you. End of discussion. If you want to argue with the people over on math.SE that's up to you. Mar 27, 2017 at 5:48
• I removed my downvote. I still don't agree that the corner in the Laplace is in any sense cheating. It's simply a counterexample to the uncritical use of the derivative -- continuous functions can have corners. Mar 27, 2017 at 7:13