# Maximum of a function

1. Feb 12, 2012

### Cinitiator

1. The problem statement, all variables and given/known data
I have an equation q*(p-q). I need a function with which I could specify a p, and which would ouput a q at which q*(p-q) is maximized.

For example:

f(p) -> analyzes y = q*(p-q) -> outputs the q at which y reaches it's maximum (in other words, f(p) = maximum of y at a given p).

2. Relevant equations
q*(p-q)

3. The attempt at a solution

Tried to apply the second partial derivative test to this, but it came out inconclusive with a D = 0. It seems like I applied it where it isn't needed at all.

2. Feb 12, 2012

### tiny-tim

Hi Cinitiator!
shouldn't do

(did you d/dp instead of d/dq ?)

show us what you did

3. Feb 12, 2012

### SammyS

Staff Emeritus
First of all, (and I expect that you will see this mentioned several times in this thread)
"I have an equation q*(p-q)."​
" q*(p-q) " is a mathematical expression. It's not an equation. An equation has two mathematical expressions separated by an " = " sign.

You say that for any particular value of p, you want to find a q which maximizes q*(p-q) .
Let g(q) = q*(p-q). That is equivalent to: g(q) = -q - pq .

That's a quadratic in q, with q-intercepts of q=0, and q=p. The vertex occurs at q = p/2. q2 has a negative coefficient, so that should tell you whether the vertex corresponds to a maximum or a minimum.

4. Feb 12, 2012

### Cinitiator

Why not to use partial derivatives instead?

One could do this:

1) Find the partial derivative with the respect to q
d/dq [q(p-q)] = d/dq [q*p-q^2] = d/dq [q*p ] - d/dq [q^2] = p - 2q

2) Then find critical points
d/dq = 0
p - 2q = 0
(-2)q = -p
q = (-p)/(-2)

q = p/2

Then f(p) = p/2

I tested it graphically and it seems to work.

I looked through my notes, and it seems that this was the case, lol. I inverted p and q multiple times. Wish I had a better working memory.

5. Feb 12, 2012

### tiny-tim

Hi Cinitiator!
yup!

(btw, with quadratics, you can find the turning-points without calculus, if you complete the square )
you'll have to …