Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2011-09-14 02:43:07

anony
Guest

Urgent help - Easy differentiation problem!

I'm using the symbol ^ to say: "raised to the power of".
I have an expression for which I need the maximum value of the variable "p":

(p^N) * (1 - p) ^ (N-Ni)

So I just need to differentiate the above expression respect to p, setting the final value as 0.

But I'm finding it a bit beyond me! Please help!

#2 2011-09-14 02:52:09

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Urgent help - Easy differentiation problem!

Hi anony;

Did you try the product rule?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#3 2011-09-14 03:00:34

anony
Guest

Re: Urgent help - Easy differentiation problem!

I did, thanks, but I don't get beyond the first step:

( Np^(N-1) * (1-p)^(N-Ni) ) +  ( p^N * (N - Ni) (1 - p)^(N - Ni - 1) )

How can I express p in terms of N and Ni?

#4 2011-09-14 03:05:38

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Urgent help - Easy differentiation problem!

Hi;

You do not have to express it in terms of Ni. That is unless you have N and Ni are independent variables. Otherwise they are constants.

I assume you are doing single variable calculus. So that:


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#5 2011-09-14 03:13:54

anony
Guest

Re: Urgent help - Easy differentiation problem!

Okay, this was the question:

Consider a language with only two symbols I and O. The proportion pI of the symbol I in the language is unknown. Suppose one particular sample text consists of a sequence of N symbols drawn randomly and independently from the language, out of which the symbol I occurs NI times and the symbol O occurs N – NI times in this particular sample text.
(a) Write an expression for the probability of the sample text in terms of pI, NI, and N.
(b) Derive mathematically the value of pI that maximizes the probability of the sample text, in terms of NI and N. This value serves as an estimate of pI.

So for part (a) I got the following expression: (pI^N) * (1 - pI) ^ (N-NI)
For part (b), to find the maximum likelihood, I need to differentiate and set to 0. But given the question, there must be a way to get the value of pI? Yes, N and NI are constants. But somehow I think they'll cancel out somewhere so I can get a value for pI?

#6 2011-09-14 03:21:33

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Urgent help - Easy differentiation problem!

Hi;

You have a dependent variable y and an independent variable p.

For the sake of our sanity I have lower cased N and Ni. This is just a single variable calculus problem since you are saying n and ni are constants. Use the rule:

Where:

First term of A) is

Second term is:

and will require the chain rule.

We need the g'(p) in B).

Using a dummy variable y, say:

Then we have:

You now have everything you need to finish the differentiation. Please give it a try.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#7 2011-09-14 03:59:49

anony
Guest

Re: Urgent help - Easy differentiation problem!

I do.

I believe that's what I did up there, to get this:
( Np^(N-1) * (1-p)^(N-Ni) ) +  ( p^N * (N - Ni) (1 - p)^(N - Ni - 1) )
I've already applied the chain rule on the second term. (Where do you type your neat mathematical symbols?)

But that isn't getting anywhere.

To make matters worse, I just realized my initial expression should actually be prefixed with a combination, that is N C Ni, which means:
N! / Ni! (N-Ni)!

So the expression to differentiate becomes:

[N! / Ni! (N-Ni)!] * p^Ni * (1-p)^(N-Ni)

I have never differentiated anything with a combination. I suppose there's a way to take some common factor...?

#8 2011-09-14 04:05:37

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Urgent help - Easy differentiation problem!

Please, one thing at a time. You keep adding to the original problem before any part is done. There is no problem with an Ncr in front. As long as it does not contain the independent variable.

I've already applied the chain rule on the second term. (Where do you type your neat mathematical symbols?)

But that isn't getting anywhere.

I disagree that we are getting nowhere. It is much too early for that. Never jump ahead when doing a problem. Focus on one step at a time, never two!

Latex which is part of this forum does the neat math for me.

Can you now complete post #6 on your own?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#9 2011-09-14 04:36:43

anony
Guest

Re: Urgent help - Easy differentiation problem!

Thanks for your helpful response.

I'm not sure if I'm missing something here, but the chain rule that you mentioned is what I did apply, and I mentioned the result of applying it in post # 3.

I applied it again now as you asked, but I still get the following, is it not correct?
These are the terms A + B:

Np^(n-1) * (1-p)^(N-Ni)   +    p^N * (N - Ni)(1 - p)^(N-Ni-1)

Term B is g'(p) with the chain rule applied. Is this right?

#10 2011-09-14 04:39:16

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Urgent help - Easy differentiation problem!

Hi anony;

Its form is correct but it has the wrong sign.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#11 2011-09-14 04:53:36

anony
Guest

Re: Urgent help - Easy differentiation problem!

Oh, right! Because p in the term (1 - p) has a negative sign but coefficient of one, the term gets multiplied with -1.

So the complete expression then, is:

nCni * n p ^ (n-1) * (1 - p) ^ (n-ni)   +   p^ni * (n - ni) * (1 - p) ^ (n-ni-1)

Thank you.

But the part that I was afraid was going nowhere, is that how can this now be expressed in terms of p? Since I want a value for p that maximizes this entire expression, I set the RHS to be 0 after getting it differentiated in terms of p.

But there is not just p, there is also (1 - p) as a term on its own that gets raised to constant exponents. I tried using logs to solve this (spent almost two hours I think on it), but to no avail. How can this be solved?

#12 2011-09-14 04:55:01

anony
Guest

Re: Urgent help - Easy differentiation problem!

Oops - I put a plus sign there again between terms A and B instead of a minus!

#13 2011-09-14 04:56:45

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Urgent help - Easy differentiation problem!

You expression in #11 is difficult to read. Is that n choose ni ?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#14 2011-09-14 05:06:26

anony
Guest

Re: Urgent help - Easy differentiation problem!

Yes, it's that n choose ni.
(Sorry I tried using the [math] tag but either I'm using it wrong or it was only applying the superscript to first character following a "^" symbol, so the expression was coming out even more difficult to understand.)

#15 2011-09-14 05:09:58

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Urgent help - Easy differentiation problem!

First the good part:

You need to put the whole subscript between { }, Like this e^{ax} comes out.

Now for the bad part.

The derivative in #11 is incorrect.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#16 2011-09-14 05:26:34

anony
Guest

Re: Urgent help - Easy differentiation problem!

Oh my, I don't believe this!

Okay, I've tried it again:

#17 2011-09-14 05:30:31

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Urgent help - Easy differentiation problem!

Nope. When you pull the ncr through the derivative because it is a constant, it gets to multiply both terms.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#18 2011-09-14 05:56:25

anony
Guest

Re: Urgent help - Easy differentiation problem!

Sigh.
Okay, I got that.
If that is the case, then running through it all again, I get from the question that the probability of the sample text is:

(there was a small mistake in the original one I posted, I just noticed big_smile)

So differentiating would give:

Then when I set this to 0, I can cancel out the

, since it's a constant, and notice that exponents like
just mean that the base can go down into a denominator. That way I can cancel out
and
too. So that I'm left with:




FINALLY. Thank you SOOO much! dizzy

#19 2011-09-14 05:59:37

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Urgent help - Easy differentiation problem!

Hi;

I am happy that you are satisfied but I would not make those simplifications of just dropping off factors.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#20 2011-09-14 06:05:30

anony
Guest

Re: Urgent help - Easy differentiation problem!

Really?

But they're all consonants, and with the RHS = 0, they carry no value, isn't that right? Don't they all cancel out? I don't see another way to express p in terms of N and Ni otherwise.

#21 2011-09-14 06:07:15

anony
Guest

Re: Urgent help - Easy differentiation problem!

Constants, sorry, not consonants. I dropped them out after finding the common factors.

#22 2011-09-14 06:11:33

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Urgent help - Easy differentiation problem!

Hi;

The exponents may not go negative. For another they are connected by multiplication not addition. If they get small they affect the whole thing. Could make it approach zero.

I don't see another way to express p in terms of N and Ni otherwise.

Sometimes there is no way to isolate a particular variable by itself. Such equations are called implicit. They can still be solved numerically though.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#23 2011-09-14 06:25:01

anony
Guest

Re: Urgent help - Easy differentiation problem!

I see. Does it help if we believe there are some assumptions hidden in the question, such as n-ni-1 will always be positive.

This is the second step I didn't type out (after dropping the nCni constant):

so for example, to represent

in Term A, i simply left it as
and put a
in the denominator, so that I could take take
common.

How would you to do it? Would you simplify but leave all the exponents of n and ni?

#24 2011-09-14 06:28:14

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Urgent help - Easy differentiation problem!

I would try to establish what the constants are. Is this a school problem or a real world one?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#25 2011-09-14 06:32:24

anony
Guest

Re: Urgent help - Easy differentiation problem!

School problem (grad school to be specific! Yes it's true i've forgotten all my high school calculus).
For the question I pasted in post # 5.

Board footer

Powered by FluxBB