Maximum value of two variables

In summary: This equation sets up a relation between X and Y. If you choose X, then Y is given by the formula above. If you choose Y, then you get two values of X. Thus, X and Y are not independent variables.
  • #1
867
17
I'm just doing some geometry and I can't remember how to find the maximum values of two variables in the same equation. Like, if you differentiate the equation partially for one, then again from the beginning partially for the other and add them together or something.

The equation is something like (where C and K are constants)
[Y*cos(30) +(K^2 + (X/2)^2)^0.5] / cos(30) = C

It's been a long time since I did something like this, though simple it may be, I vaguly remember doing something similar for the maximum size of a rectangle or something.

Thanks
 
Physics news on Phys.org
  • #2
Your question is not clear. You ask about "how to find the maximum values of two variables in the same equation" but I don't think that is what you want to do. I thing that what you want to do is to find the value of two variables in a function (not equation) that make the value of the function (not the variables) maximum.

To do that take the partial derivative of the function, with respect to the two variables, set them both equal to 0 and solve those two equations for the two variables, not "add them together".

In your example, I think the function you want to maximize is [tex]\frac{Y^2 cos(30)+ (K^2+ (X/2)^2)^{1/2}}{cos(30)}[/tex],
the derivative with respect to X is [tex]\frac{X}{2cos(30)(\sqrt{K^2+ (X/2)^{1/2}})}[/tex] and the derivative with respect to Y is [tex]2Y[/tex].
 
  • #3
If C and K are constants, you have just a convoluted way of expressing y=f(x). If you want to maximize for y, just do it...
 
  • #4
HallsofIvy said:
Your question is not clear. You ask about "how to find the maximum values of two variables in the same equation" but I don't think that is what you want to do.
Svein said:
If C and K are constants, you have just a convoluted way of expressing y=f(x). If you want to maximize for y, just do it...
Good point, sorry.
I meant like the maximum of the sum of the two variables (biggest X + Y combination to satisfy the equation)

HallsofIvy said:
In your example, I think the function you want to maximize is
Y2cos(30)+(K2+(X/2)2)1/2cos(30)​
\frac{Y^2 cos(30)+ (K^2+ (X/2)^2)^{1/2}}{cos(30)},
the derivative with respect to X is
X2cos(30)(K2+(X/2)1/2−−−−−−−−−−−−√)​
\frac{X}{2cos(30)(\sqrt{K^2+ (X/2)^{1/2}})} and the derivative with respect to Y is
2Y

That's great thanks, except there was no y^2, with that in mind, are you saying the maximum of of the equation is:
X/ [2cos(30)*((K^2+ (X/2)^(1/2))] = 0

Because y' = 0

I still can't remember though, so I've added them both together, is the sum of the partial derivitives still = 0
or is it equal to a the constant 'C'?
And how is this finding the values of the variables, under which they are at maximum values satisfying the equation.
Sorry I am SO rusty.
 
  • #5
tim9000 said:
I meant like the maximum of the sum of the two variables (biggest X + Y combination to satisfy the equation)

If you want to maximize y+x and you already have y = f(x), then define z = y + x = f(x) + x...
 
  • #6
Svein said:
If you want to maximize y+x and you already have y = f(x), then define z = y + x = f(x) + x...

So:

Y = [C - (K^2 + (X/2)^2)^0.5] / cos(30) ] / cos(30)

then

Z = [C - (K^2 + (X/2)^2)^0.5] / cos(30) ] / cos(30) + X
Then Z' = X/ [2cos(30)*((K^2+ (X/2)^(1/2))] + 1 = 0 ?

So then rearrange for X maximum value?

If so, then do I just put that value back into the original equation for Y's maximum value?
 
  • #7
tim9000 said:
So then rearrange for X maximum value?

If so, then do I just put that value back into the original equation for Y's maximum value?

Well, solve for X and the calculate Y. You just maximized X + Y.

You keep getting back to solving for X and Y. But your function specifies that Y depends on X. Therefore you cannot look for the maximum of X and Y separately since, given X, the value of Y is also given.
 
  • #8
Svein said:
You keep getting back to solving for X and Y. But your function specifies that Y depends on X. Therefore you cannot look for the maximum of X and Y separately since, given X, the value of Y is also given.

I wasn't the one that said it was Y = f(X), as far as I am concerned it is just an expression with two independant variables. Where the Left hand side has to equal the constant C. And I want X and Y to be fairly ballanced out, not just one big variable and one small one.
 
  • #9
tim9000 said:
The equation is something like (where C and K are constants)
[Y*cos(30) +(K^2 + (X/2)^2)^0.5] / cos(30) = C
This equation sets up a relation between X and Y. If you choose X, then Y is given by the formula above. If you choose Y, then you get two values of X. Thus, X and Y are not independent.
 
  • #10
Yes, that's true, although I did realize the implications of that, thanks for pointing out that I did misuse the term 'independent'. I should choose more clearly and carefully.
Is my question clear though now? You can choose a value for X or Y, so how do I calculate which value to choose for X or Y that will result in X and Y being closest to each other?
Thanks
 
  • #11
tim9000 said:
Is my question clear though now? You can choose a value for X or Y, so how do I calculate which value to choose for X or Y that will result in X and Y being closest to each other?

In what sense? Do you want to minimize Y - X or |Y - X| or...?
 
  • #12
Svein said:
In what sense? Do you want to minimize Y - X or |Y - X| or...?
Well I don't mind which is bigger, X or Y, but like if Z1 = X - Y or Z2 = Y - X, then Z1 or Z2 is as small as possible.
So if X and Y are on a seesaw they're as close as being ballanced as possible.
 
  • #13
tim9000 said:
Well I don't mind which is bigger, X or Y, but like if Z1 = X - Y or Z2 = Y - X, then Z1 or Z2 is as small as possible.
So if X and Y are on a seesaw they're as close as being ballanced as possible.

Then I propose that you minimize (Y - X)2. So y - x = (C -(K^2 - (x/2)^2)^(0.5)/cos(30))/cos(30) -x.
Square it and observe that cos(30) = √3/2. Derive and set equal to zero...
 
  • #14
Why (Y - X)2 and not (X - Y)2? I can't say I understand what you're getting at, but never the less:

(Y - X)2 = [(2C/√3) - √(K2-(X/2)2)*4/3]2 - X2

d[(Y - X)2] /dx = (4/3)2*2*X/2 - 2X = 0
= (16/9)X-2X = 0
which I don't think makes sense...
 
  • #15
tim9000 said:
(Y - X)2 = [(2C/√3) - √(K2-(X/2)2)*4/3]2 - X2

Check your arithmetic! There are several errors here.
 
  • #16
Svein said:
Check your arithmetic! There are several errors here.

All I really did was sub in for √3/2 for the two Cos, and then simplify so it became 4/3.
I'm not seeing my errors, sorry.

It would help if I understood the theory behind why we're taking the difference and squaring it.
As a simplified analogy. Say for instance you had a rectangle, and you had X and Y lengths and you wanted to find the closest you could make X and Y to make a shape of some constant surface area. Well we know intuitively that you can make X = Y and it will be a square, this is the same thing but it's a bit more complex so I don't know intutively what values of X and Y are the closest most ballenced values.
 
Last edited:
  • #17
tim9000 said:
All I really did was sub in for √3/2 for the two Cos, and then simplify so it became 4/3.
I'm not seeing my errors, sorry.
y - x = (C -(K^2 - (x/2)^2)^(0.5)/cos(30))/cos(30) -x. Substitute Cos(30)=√3/2 and get y - x = C - √(K^2 - (x/2)^2))*2/√3 - x. Square that, and get
(y-x)^2 = (C - x)^2 -2(C-x)*√(K^2 - (x/2)^2))*2/√3 + (K^2 - (x/2)^2))*4/3. Multiply and reorder:
(y-x)^2 = (C^2 + 4(K^2)/3) - 2Cx + (4x^2)/3+ 2(C-x)√(K^2 - (x/2)^2))*2/√3. Now do the rest.
tim9000 said:
It would help if I understood the theory behind why we're taking the difference and squaring it.
Because you specified that you wanted to minimize the difference between Y and X. Now the difference between Y and X may be negative and a large negative number is a valid minimum. You could minimize |Y - X|, but this is troublesome mathematically. Minimizing the square of the difference is better mathematically and removes the problem with negative differences.
 
  • #18
I see, I rearranged Y to be the wrong function in the first place, so:

[Y*cos(30) +(K^2 + (X/2)^2)^0.5] / cos(30) = C

Y = C - [√(K^2 + (X/2)^2) ] / cos(30) = C - 2*[√(K^2 + (X/2)^2) ] / √3

That's interesting, so you treated "C - X" as one term and expanded the right hand side as a perfect square? I didn't think to do that.
You still didn't answer me about : "Why (Y - X)2 and not (X - Y)2?" Is there no difference?So back to your method, that product and chain rule is a nightmare:
d [(Y - X)2 ] /dx = -2C + 8X/3 - [2XC−4X^2+8k^2] / [√3*√(2k−X)*√(X+2k)] = 0

(I used a derivative calculator)


X = something too complicated for me to work out because of that nasty fraction...

At this point I think I'd be better off trying to plot curves of the equation graphically in Excel or something and find a cross over point or something to tell me the smallest difference between X and Y satisfying the expression.
 
  • #19
I think I'd prefer to do away with all this and start again, say I had the equation 3X + Y = 100

same basic set-up, but a jolly lot simpler, so If I wanted to find the closest values of X and Y to each other to satisfy the equation, how would I do it?
Cheers!
 
  • #20
tim9000 said:
Why (Y - X)2 and not (X - Y)2?" Is there no difference?

No. (Y - X) = - (X - Y) and (-a)2 = a2
tim9000 said:
I think I'd prefer to do away with all this and start again, say I had the equation 3X + Y = 100

same basic set-up, but a jolly lot simpler, so If I wanted to find the closest values of X and Y to each other to satisfy the equation, how would I do it?
Cheers!
Same procedure. Your equations says Y = 100 - 3X and you want to minimize (Y - X). (Y - X) = 100 - 4X. (Y - X)2 = 10000 - 800X + 16X2.
The derivative is -800 + 32X, giving X = 25 and therefore Y = 100 - 3X = 100 - 75 = 25.
 
  • #21
Svein said:
No. (Y - X) = - (X - Y) and (-a)2 = a2

Ooh, so that's what you meant

Svein said:
Same procedure. Your equations says Y = 100 - 3X and you want to minimize (Y - X). (Y - X) = 100 - 4X. (Y - X)2 = 10000 - 800X + 16X2.
The derivative is -800 + 32X, giving X = 25 and therefore Y = 100 - 3X = 100 - 75 = 25

You're brilliant, thanks HEAPS.
I should have asked a simple version of the question like that in the first place!
 

What is the maximum value of two variables?

The maximum value of two variables is the largest possible value that can be obtained by combining or comparing the two variables.

How do you find the maximum value of two variables?

To find the maximum value of two variables, you can simply compare the two variables and choose the larger of the two. Alternatively, you can use mathematical operations such as addition, subtraction, multiplication, and division to manipulate the variables and determine the maximum value.

Can the maximum value of two variables change?

Yes, the maximum value of two variables can change depending on the values of the variables. If the variables are constant, the maximum value will remain the same. However, if the values of the variables change, the maximum value may also change.

What if the two variables have the same value?

If the two variables have the same value, then the maximum value will also be the same as the value of the variables. In other words, the maximum value will be equal to the value of either variable.

Is there a limit to the maximum value of two variables?

There is no limit to the maximum value of two variables. The maximum value can be infinitely large, depending on the values of the variables. However, in practical applications, there may be limitations due to the precision of the measurement or the capabilities of the system handling the variables.

Suggested for: Maximum value of two variables

Replies
12
Views
237
Replies
2
Views
1K
Replies
4
Views
1K
Replies
2
Views
950
Replies
1
Views
1K
Replies
15
Views
2K
Replies
4
Views
495
Replies
2
Views
900
Back
Top