# What will be the value of $a$ that maximizes $g(a)?$

Let $X$ be a normal random variable with mean $2$ and variance $4$, and $$g(a)=P(a\leq X\leq a+2)$$,Then what will be the value of $a$ that maximizes $g(a)?$

We can write,$$g(a)=\Phi(\frac{a}{2})-\Phi(\frac{a-2}{2})$$ Differentiating $g(a)$ we get,$g'(a)=\phi(\frac{a}{2})\frac{1}{2}-\phi(\frac{a-2}{2})\frac{1}{2}.$ Can anything be said about the maximum value of $a$ from the above?

If we equate $g'(a)=0$ we can see that the possible value of $a$ may be $1$ .But I don't understand how can we say it maximizes $g(a).$

• How do you get 4 as a possible value of a? What can you say about the 2nd derivative of g(a) when g'(a) = 0? How would the value of a which maximizes g(a) differ if the variance were $e^\sqrt{2\pi}$ instead of 4? Jun 14, 2016 at 13:28
• 4 can't be the value.I was making a mistake while calculating. Jun 14, 2016 at 13:31
• Draw a picture.
– whuber
Jun 14, 2016 at 13:39
• An answer of 1 is reasonable if you think about it. If you picture the normal curve, it's area is greatest near the mean. So you want the mean halfway between $a$ and $a+2$ i.e. at $a=1$. Jun 14, 2016 at 17:46

I have an answer I have used 2 methods to derive the solution.

# Method 1: Use of R code

On standardising the variable X to have 0 mean and variance 1 the objective function becomes

$$\Phi(\frac{a}{2}) - \Phi(\frac{a}{2} - 1)$$

I created a vector of possible values of a I don't go too far to include $-\infty$ or $\infty$ Here is the R code which produces the output

a <- seq(-20, 20, by = 0.01)
z <- pnorm(a/2) - pnorm((a/2) - 1)
plot(a, z, type = "l")
a[which.max(z)]


This outputs 1. The plot is shown in this link

The plot reveals that the maximum value of a happens at a = 1

# Method 2 Use of derivatives

1. As you point out you must differentiate the objective function
2. On differentiating equate the first derivative to zero.
3. Use the property that a normal distribution is symmetric to get $a ~ = ~ 1$
4. I hope my calculation is correct. On taking the second derivative i get the value $- \frac{1}{4}~exp\{-\frac{a^{2}}{8}\}$ This is $<$ 0 $\forall ~ a$

Hope this helps.

• 1. Please keep in mind that self-study questions are best answered using hints and guidance rather than full solutions (also see the relevant paragraph in the help center); if you do people's homework/bookwork etc for them they lose the benefit of doing any of it themselves. 2. You're making this question much, much harder than it needs to be. There's no need for code and no need for derivatives. The fact that the normal cdf is unimodal and symmetric makes it completely straightforward. whuber's suggestion (draw a picture) is good. Jun 14, 2016 at 15:31
• Sure. I will bear this in mind. Jun 14, 2016 at 15:57
• You need only these simple properties of the Normal distribution to succeed with method 2: it is unimodal, symmetric, and its PDF is never flat. It follows immediately that the derivative is zero only when $a$ and $a+2$ are equally spaced around the mean and that this yields a maximum. No computation is necessary.
– whuber
Jun 14, 2016 at 19:38