Homework Help: Legrange-&gt;System of equations

1. Dec 1, 2007

[SOLVED] Legrange--&gt;System of equations

1. The problem statement, all variables and given/known data

Suppose (a,b) is on the graph of $$f(x)=x^{2}$$ and (c,d) is on the graph of g(x)=ln(x)

a) Accurately approximate the minimum distance between (a,b) and (c,d)
b) Accurately approximate (a,b) and (c,d)
c) What is the relationship between f'(a) and g'(c)

2. Relevant equations

Just a Legrange

3. The attempt at a solution

The function that needs to be minimized is $$\sqrt{(a-c)^{2} + (b-d)^{2}}$$
Which can be left as $$(a-c)^{2} + (b-d)^{2}$$ because they will both be minimized at the same place

The Legrange:
$$L(a,b,c,d,\lambda ,\mu )=(a-c)^{2} + (b-d)^{2} - \lambda (a - b^{2}) - \mu (b-ln(d))$$

This gave me the six equations:

$$L_{a}= 2a - 2c - \lambda = 0$$
$$L_{b}= 2b - 2d - 2\lambda b = 0$$
$$L_{c}= 2c - 2a - \mu = 0$$
$$L_{d}= 2d - 2b - \frac{\mu }{d}= 0$$
$$L_{\lambda }= a = b^{b}$$
$$L_{\mu }= c = ln (d)$$

This is where I am stuck
I tried for quite some time to solve for the system of equations and I am at a point where i don't know where to go.

The things I got out of them is:

$$\lambda$$ = -$$\mu$$ This is from $$L_{a}=L_{c}$$
and
$$bd=\frac{1}{2}$$

I got this by taking $$L_{a}=0$$ and $$L_{b}=0$$ therefore:
$$L_{a} = L_{b}$$ --> $$L_{a} - L_{b} = 0$$ --> $$L_{a} - L_{b} = L_{c}$$

And so on till I got: $$L_{a} - L_{b} - L_{c} - L_{d} = 0$$
Then using some substitution for $$\lambda$$ and $$\mu$$ I got bd =$$\frac{1}{2}$$

The instructor of my course said I could use software on any of the problems in the handout but even when I tried plugging the equations into mathematica I got an error. I just don't know where to go with the equations.

2. Dec 1, 2007

EnumaElish

$L_\lambda = a - b^2$ and $L_\mu= c - ln (d)$ are binding; so a = b^2 and c = ln (d). These plus the 4 equations Lp = 0 for p = a, b, c, d give you 6 equations in 6 unknowns (a, b, c, d, $\lambda, \mu$).

In mathematica try Solve[eq1 == ... == eq6 == 0}. (Edit: Solve[eq1 == ... == eq6 == 0].)

Last edited: Dec 2, 2007
3. Dec 2, 2007

Thanks for the response

I typed it in as you instructed (as close as possible to yours)

I recieved the response that is shown in my attachment. Why does it not give me numeric results? I could have recieved 20 different representations for that if I wanted to simply by rearranging equations.
Can I use these results to get numerical results in mathematica or do I need to sit down and start to rearrange equations again?
(which I am doing anyways)

Thanks again

File size:
13.1 KB
Views:
98
4. Dec 2, 2007

EnumaElish

My guess is that the "Log" term is creating a nonlinearity that Mathematica finds difficult to solve analytically. An alternative solution method:

FindRoot[
{
D[L[a, b, c, d, \[Lambda], \[Mu]], a] ==
D[L[a, b, c, d, \[Lambda], \[Mu]], b] ==
D[L[a, b, c, d, \[Lambda], \[Mu]], c] ==
D[L[a, b, c, d, \[Lambda], \[Mu]], d] ==
D[L[a, b, c, d, \[Lambda], \[Mu]], \[Lambda]] ==
D[L[a, b, c, d, \[Lambda], \[Mu]], \[Mu]] == 0
},
{{a, 1}, {b, 1}, {c, 2}, {d, Log[2]}, {\[Lambda], 1}, {\[Mu], 1}}
]

yields:

{a -> 0.289624, b -> 0.538168, c -> -0.0735622,
d -> 0.929078, \[Lambda] -> 0.726373, \[Mu] -> -0.726373}

Last edited: Dec 2, 2007
5. Dec 2, 2007

EnumaElish

You can also try substituting Exp[c] = d for c = Log[d]. The "Exp" expression seems to work with Solve. Defined that way, Solve yields:

{a -> 0.289624, b -> 0.538168, c -> -0.0735622,
d -> 0.929078, \[Lambda] -> 0.726373, \[Mu] -> -0.726373}

which is the identical to the FindRoot solution above.

6. Dec 2, 2007

kompik

Are you supposed to use Lagrange multipliers? Perhaps the approach minimizing would be good, too.

Reformulation: Minimize $$H(s,t)=(t-s)^2+(t^2-\ln s)^2$$ for $$s,t \in \mathbb R$$ and $$s>0$$.

Differentiating:
$$H_t=2(t-s)+4t(t^2-\ln s)=0$$
$$H_s=-2(t-s)-\frac{2(t^2-\ln s)}s=0$$

$$4t(t^2-\ln s)-\frac{2(t^2-\ln s)}s=0$$
$$(t^2-\ln s)\left(4t-\frac{2}s\right)=0$$

Using these equations we get $$2ts=1$$.

By plugging this into one of the above equation we get
$$2(t-1/2t)+4t(t^2+\ln(2t))=0$$
One equation, one unknown - perhaps easier to solve.

More generally: Minimize $$H(s,t)=(t-s)^2+(f(t)-g(s))^2$$.

Differentiating:
$$H_t=2(t-s)+2f'(t)(f(t)-g(s))=0$$
$$H_s=-2(t-s)-2g'(s)(f(t)-g(s))=0$$

$$f'(t)(f(t)-g(s))-g'(s)(f(t)-g(s))=(f'(t)-g'(s))(f(t)-g(s))=0$$

Two possibilities:
$$f(t)=g(s)$$ which implies (using the above equations) $$t=s$$, i.e. the two graphs have intersection.
$$f'(t)=g'(s)$$ (the tangent lines are parallel) and $$t-s+f'(t)(f(t)-g(s))=0$$ (the line segment between the two points is perpendicular to the tangent line)
This corresponds very nicely to our geometrical intuition.
[I guess this is what your teacher wants you to see - at least that's why there is the last question.]

7. Dec 3, 2007

I tried to simply minimize the equation like you did kompik since I cannot get mathematica to spit out the results (I don't know why, but it doesn't matter).

I couldn't get mathematica to solve the equation so I simply put it into my calculator and used the zero function to get my answer. I got 0.538168 for the s value in your equation.

To find the error in this estimation (since my calculator only gives me the answer to a few decimals)

t = 0.538168

$$2(t-1/2t)+4t(t^2+\ln(2t))=3.6947 x 10^{-6}$$

$$\frac{0.538168-3.6947 x 10^{-6}}{0.538168} x 100 = 99.9993 Percent$$ << Good enough for me. Thanks for the help.

Last edited: Dec 3, 2007