1. Maximize (math stats)

I'm not sure if this is the correct forum for this. The problem is that I'm too rusty to remember how to do this, and possibly even classify the problem. This is something from my Math Stats class.

I'm asked to find the value of p (in terms of y and n) that maximizes:
y * ln(p) + (n-y) * ln(1 - p), for 0 < y < n, where y and n are constants.
Be sure that you have a maximum.

I was able to complete the rest of the assignment fine (mostly teaching us to use R), but I'm not sure where to start this. Could someone give me a hint here?

2. Re: Maximize (math stats)

Can you find the derivative with respect to p?

3. Re: Maximize (math stats)

Originally Posted by TKHunny
Can you find the derivative with respect to p?
Let's see, the derivative with respect to p..

y * ln(p) + (n-y) * ln(1 - p)
y * (1 / p) + (n - y) * (1 / (1 - p)) * -1
(y/p) - (n-y)/(1 - p)

I have to go to sleep now. I'm not sure where to go from here, but I will think about it.

4. Re: Maximize (math stats)

Good. For what value of p does this expression take on zero?

5. Re: Maximize (math stats)

Here is my first idea:
As p approaches either infinity or negative infinity, the expression approaches zero.
Which means that the expression is never zero.
Since y/p will always be positive for positive values of p, and (n-y)/(1 - p) will always be negative for sufficiently large positive values of p, as p increases, (y/p) - (n-y)/(1 - p) is always positive.
So, the rate of change is always positive, the original expression has no maximum value for p.

Except.. this hand out seems to be quite adamant about the fact that there is a maximum.

Second idea:
If (y/p) were to = (n-y)/(1 - p), then the derivative expression would be zero.
So, i set them equal to one another and solved for p, p = y/n
However when I go back and check that (y/p) - (n-y)/(1 - p) evaluates to zero for p = y/n, I find that it doesn't.
Is my logic unsound here somewhere?

Thank you for your help TKHunny

6. Re: Maximize (math stats)

Not sure what you're doing with that. You should get zero. p = y/n is good. Try it again.

7. Re: Maximize (math stats)

Originally Posted by Relmiw
Here is my first idea:
As p approaches either infinity or negative infinity, the expression approaches zero.
Which means that the expression is never zero.
Where did you get that idea? The fact that a function goes to 0 as x goes to infinity and negative infinity does NOT mean it cannot be 0 someplace in between.

Since y/p will always be positive for positive values of p, and (n-y)/(1 - p) will always be negative for sufficiently large positive values of p, as p increases, (y/p) - (n-y)/(1 - p) is always positive.
So, the rate of change is always positive, the original expression has no maximum value for p.

Except.. this hand out seems to be quite adamant about the fact that there is a maximum.

Second idea:
If (y/p) were to = (n-y)/(1 - p), then the derivative expression would be zero.
So, i set them equal to one another and solved for p, p = y/n
However when I go back and check that (y/p) - (n-y)/(1 - p) evaluates to zero for p = y/n, I find that it doesn't.
Is my logic unsound here somewhere?

Thank you for your help TKHunny
Well, your logic is unsound when you argue that if a function goes to 0 at infinity and negative infinity it cannot be 0 for any finite value. That's simply not true.

As far finding that (y/p)- (n-y)/(1- p) is not 0 when p= y/n, that's not unsound logic, it's just bad algebra!
if p= y/n then y/p= y/(y/n)= y(n/y)= n. 1-p= 1- y/n= (n-y)/n so that (n- y)/(1- p)= (n-y)(n/(n-y))= n.

If y= y/n, then (y/p)- (n-y)/(1- p)= n- n= 0.

8. Re: Maximize (math stats)

Ok, I did get zero. Meaning when p = y/n, the rate of change for the original expression is zero.

I see how the fact that the derivative approaches 0 as p increases does not in itself mean the derivative is never evaluated at 0, but it would not be evaluated at 0 if p > 1 (because n > y).

If p were to = 4, then the derivative is positive.
So, the expression is not changing at the point evaluated at y/n, but is increasing for all values p > 1.

Thanks for your help so far. Please, don't solve this problem for me. I'm just trying to figure out why that would be a maximum

9. Re: Maximize (math stats)

Use either the "first derivative test" or "second derivative test".

10. Re: Maximize (math stats)

Using the second derivative test, i test my single critical point (y/n), and i see that the second derivative is negative at this point. Meaning the function is concave down at the only crit point and thus it must be a maximum.

But, the first derivative test isn't yielding the same results for me.
We have a critical point at y/n, so I choose a value to the right and a value to the left of this.
p = 2 is always greater than y/n, and p = -1 is always lesser.
Checking both points is telling me that this point is a minimum.
Here is my attempt at checking p = -1

y/p - (n-y)/(1-p)
y/(-1) - (n-y)/(1-(-1))
-y - (n-y)/2
-y - positive number
negative number

Similarly I'm getting a positive number while testing p = 2.