X = p * y. Find x, y when both are as close to 1 as possible

  • Thread starter Thread starter simplex1
  • Start date Start date
AI Thread Summary
The discussion focuses on finding values for x and y in the equation x = p * y, where both x and y should be as close to 1 as possible, given constraints on p, x, and y. Initial suggestions included x = 1 and y = sqrt(p), but further analysis revealed that the correct approach involves minimizing the function w(x) = (x - 1)^2 + (y - 1)^2. The method of Lagrange multipliers was proposed to handle the constraints effectively, leading to a system of equations that relate x, y, and the Lagrange multiplier. The conversation emphasizes the importance of deriving a numeric solution for x and y using this method, especially when specific parameters are known.
simplex1
Messages
50
Reaction score
1
Knowing that:

x = p * y where p = (0, 1] and x, y = (0, 2]

find x and y in such a way that both of them be as close as possible to 1 simultaneously.

I guess that the solution is x = 1/y = sqrt(p) but I do not know how to prove it.
 
Mathematics news on Phys.org
simplex1 said:
Knowing that:

x = p * y where p = (0, 1] and x, y = (0, 2]
What does p = (0, 1] mean? What does x, y = (0, 2] mean? Does the first one mean ##x \in (0, 1]##?
Can you pick p = 1, and then let x = y = 1?
simplex1 said:
find x and y in such a way that both of them be as close as possible to 1 simultaneously.

I guess that the solution is x = 1/y = sqrt(p) but I do not know how to prove it.
 
- Yes, x,y=(0,2] means x∈(0,2] and y∈(0,2].
- p is a given constant. In my specific case p = 0.457.
 
Since p is a constant, then for a given x value, the y value is y = x/p = x/.457 .
If you let w = (x - 1)2 + (x/.457 - 1)2, you're looking for the value of x that minimizes w.

Edited above to fix my earlier mistake.
 
Last edited:
I believe it should be w(x) = (x - 1)^2 + (x/p - 1)^2 = minim which has the solution:
x = p(p+1)/(p^2+1)
It appears that x is not sqrt(p).
 
simplex1 said:
I believe it should be w(x) = (x - 1)^2 + (x/p - 1)^2 = minim
Yes, I switched p and x due to a silly mistake on my part. I have edited my earlier post.
simplex1 said:
which has the solution:
x = p(p+1)/(p^2+1)
It appears that x is not sqrt(p).
 
I want now to minimize ## w(x) = (x - 1)^2 + (y - 1)^2 ## knowing that ## px^3+qx^2y+rxy^2+ty^3=0 ## but without solving the equation to obtain y as a function of x and then replace it in ## w(x) ## because this appears to be impractical. Is it possible?
 
Use "Lagrange multipliers". Since w(x,y)= (x- 1)^2+ (y- 1)^2, \nabla w= 2(x- 1)\vec{i}+ 2(y- 1)\vec{j}. Writing the constraint as f(x,y)= px^3+ qx^2y+ rxy^2+ ty^3, \nabla f= (3px^2+ 2qxy+ ry^2)\vec{i}+ (qx^2+ 3rxy+ 3ty^3)\vec{j}. At a max or min of w, with constraint f, those two gradient vectors must be parallel. That is, there must exist a number, \lambda (the "Lagrange Multiplier") such that 2(x- 1)\vec{i}+ 2(y- 1)\vec{j}= \lambda[(3px^2+ 2qxy+ ry^2)\vec{i}+ (qx^2+ 3rxy+ 3ty^3)]\vec{j}.

That gives the equations 2(x- 1)= \lambda (3px^2+ 2qxy+ ry^2) and 2(y- 1)= \lambda(qx^2+ 3rxy+ 3y^3) which, together with the constraint, give three equations to solve or x, y, and \lambda. Since a value for \lambda is not part of the solution to this problem, I find that it is often simplest to first eliminate \lambda by dividing one equation by the other. Dividing the first of those two equations by the second,
\frac{2(x- 1)}{2(y- 1}= \frac{3px^2+ 2qxy+ ry^2}{qx^2+ 2rxy+ 3ty^3}.

That is, of course, equivalent to (x- 1)(qx^2+ 2rxy+ 3ty^3)= (y- 1)(3px^2+ 2qxy+ ry^2).
 
  • Like
Likes T Damen
Yes, the method of Lagrange is a good idea because numeric solutions for x and y can be found with Mathcad if the parameters are known. Thank you all for your help.
 
Back
Top