# differential equation question, I think

**URL:** <https://boards.straightdope.com/t/differential-equation-question-i-think/178678>\
**Category:** Factual Questions\
**Created:** [May 31, 2003, 1:11am UTC](https://boards.straightdope.com/t/differential-equation-question-i-think/178678 "2003-05-31T01:11:18Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [May 31, 2003, 1:11am UTC](https://boards.straightdope.com/t/differential-equation-question-i-think/178678/1 "2003-05-31T01:11:18Z")

</div>

All right, I’ve got a question that I think can best be answered by a differential equation, which is definitely not my specialty.

I’ve got a function f(x, y), and a relationship between discrete changes in x and y. f(x, y) = x/(x + y), and [symbol]D[/symbol]y/([symbol]D[/symbol]x + [symbol]D[/symbol]y) = [symbol]a[/symbol]/([symbol]a[/symbol] + x[sub]0[/sub]). What I want to know is what change in x and y will cause the greatest _decrease_ in f. As I understand it, the gradient will tell me the direction of greatest change, but that could be an increase.

What do I do from here?

---

<div class="post-metadata">

**Author:** ![John\_Mace](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/john_mace/32/185_2.png) [@John\_Mace](https://boards.straightdope.com/u/John_Mace)\
**Post date:** [May 31, 2003, 1:25am UTC](https://boards.straightdope.com/t/differential-equation-question-i-think/178678/2 "2003-05-31T01:25:42Z")

</div>

Look at whether it is positive or negative?

---

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [May 31, 2003, 2:49am UTC](https://boards.straightdope.com/t/differential-equation-question-i-think/178678/3 "2003-05-31T02:49:00Z")

</div>

All right, I was totally confused when I wrote the OP. I’ve got the current values of x and y, and I want to find new values of x and y such that f(x[sub]new[/sub], y[sub]new[/sub]) = [symbol]b[/symbol] (a constant) and the cost function c[sub]1[/sub][symbol]D[/symbol]x + c[sub]2[/sub][symbol]D[/symbol]y is minimized.

It seems to me that I’ve got a relationship between [symbol]D[/symbol]x and [symbol]D[/symbol]y, and it works out to be [symbol]D[/symbol]x = x[sub]0[/sub][symbol]D[/symbol]y/[symbol]a[/symbol]. So I’m trying to minimize c[sub]1[/sub]x[sub]0[/sub][symbol]D[/symbol]y/[symbol]a[/symbol] + c[sub]2[/sub][symbol]D[/symbol]y. But I’m not sure how to approach this from here.

---

<div class="post-metadata">

**Author:** ![g8rguy](https://avatars.discourse-cdn.com/v4/letter/g/7cd45c/32.png) [@g8rguy](https://boards.straightdope.com/u/g8rguy)\
**Post date:** [May 31, 2003, 2:55am UTC](https://boards.straightdope.com/t/differential-equation-question-i-think/178678/4 "2003-05-31T02:55:35Z")

</div>

So let me get this straight. f(x,y) = x/(x+y), and [symbol]D[/symbol]x = x[sub]0[/sub] [symbol]D[/symbol]y/[symbol]a[/symbol]. Given this, find the value of [symbol]D[/symbol]y such that the decrease in f(x,y) is maximized?

---

<div class="post-metadata">

**Author:** ![g8rguy](https://avatars.discourse-cdn.com/v4/letter/g/7cd45c/32.png) [@g8rguy](https://boards.straightdope.com/u/g8rguy)\
**Post date:** [May 31, 2003, 2:59am UTC](https://boards.straightdope.com/t/differential-equation-question-i-think/178678/5 "2003-05-31T02:59:04Z")

</div>

:smack:

Okay, I’m an idiot. Note to self: read _all_ posts before opening your fat yap.

I think what you want to do is to solve x/(x+y) = [symbol]b[/symbol]. I get x/[symbol]b[/symbol]-1=y. Given this relation, and that [symbol]D[/symbol]x = x[sub]0[/sub] [symbol]D[/symbol]y/[symbol]a[/symbol], solve for [symbol]D[/symbol]y which minimizes the cost function.

Am I right this time, or am I still being an idiot?

---

<div class="post-metadata">

**Author:** ![Trigonal\_Planar](https://avatars.discourse-cdn.com/v4/letter/t/0ea827/32.png) [@Trigonal\_Planar](https://boards.straightdope.com/u/Trigonal_Planar)\
**Post date:** [May 31, 2003, 3:01am UTC](https://boards.straightdope.com/t/differential-equation-question-i-think/178678/6 "2003-05-31T03:01:19Z")

</div>

Hmmm, can you use LaGrange multipliers on the equation to be minimized to find the critical points for f(x, y)?

---

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [May 31, 2003, 3:09am UTC](https://boards.straightdope.com/t/differential-equation-question-i-think/178678/7 "2003-05-31T03:09:15Z")

</div>

> [@](#):
>
> \*Originally posted by g8rguy \*  
> \*\*:smack:
> 
> Okay, I’m an idiot. Note to self: read _all_ posts before opening your fat yap.
> 
> I think what you want to do is to solve x/(x+y) = [symbol]b[/symbol]. I get x/[symbol]b[/symbol]-1=y. Given this relation, and that [symbol]D[/symbol]x = x[sub]0[/sub] [symbol]D[/symbol]y/[symbol]a[/symbol], solve for [symbol]D[/symbol]y which minimizes the cost function.
> 
> Am I right this time, or am I still being an idiot? \*\*

I get that y = (1/[symbol]b[/symbol] - 1)x.

---

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [May 31, 2003, 3:10am UTC](https://boards.straightdope.com/t/differential-equation-question-i-think/178678/8 "2003-05-31T03:10:25Z")

</div>

> [@](#):
>
> \*Originally posted by Trigonal Planar \*  
> \*\*Hmmm, can you use LaGrange multipliers on the equation to be minimized to find the critical points for f(x, y)? \*\*

I suppose I could, but it’s been a long time since I’ve done anything like that.

---

<div class="post-metadata">

**Author:** ![g8rguy](https://avatars.discourse-cdn.com/v4/letter/g/7cd45c/32.png) [@g8rguy](https://boards.straightdope.com/u/g8rguy)\
**Post date:** [May 31, 2003, 3:17am UTC](https://boards.straightdope.com/t/differential-equation-question-i-think/178678/9 "2003-05-31T03:17:12Z")

</div>

Blast! I somehow forgot my parentheses. I’m dreadfully unhelpful and have had one too many glasses of wine, I guess.

Your equation relating [symbol]D[/symbol]x to [symbol]D[/symbol]y is FROM solving f(x,y) = [symbol]b[/symbol], isn’t it? If I haven’t even understood that much, I’m going to go into a corner and cry.

---

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [May 31, 2003, 3:50am UTC](https://boards.straightdope.com/t/differential-equation-question-i-think/178678/10 "2003-05-31T03:50:26Z")

</div>

No, the equation relating [symbol]D[/symbol]x to [symbol]D[/symbol]y is independent of f(x, y) = [symbol]b[/symbol]. It’s just another constraint.

Besides, math is more fun when you’re drunk.

I think I made this more complicated than it needs to be. f(x, y) = [symbol]b[/symbol] is equivalent to y = (1 - [symbol]b[/symbol])x/[symbol]b[/symbol], and [symbol]D[/symbol]x = x[sub]0[/sub][symbol]D[/symbol]y/[symbol]a[/symbol] is equivalent to x - x[sub]0[/sub] = x[sub]0[/sub](y - y[sub]0[/sub])/[symbol]a[/symbol]. Those are both linear equations relating x and y.

:smack:

So all we have to do is solve them simultaneously, and we’re good to go. Unfortunately, the algebra gets rather nasty from here on out. It looks like there’s only one point that satisfies the initial conditions, cost function be damned.

---

<div class="post-metadata">

**Author:** ![Achernar](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@Achernar](https://boards.straightdope.com/u/Achernar)\
**Post date:** [May 31, 2003, 10:07am UTC](https://boards.straightdope.com/t/differential-equation-question-i-think/178678/11 "2003-05-31T10:07:17Z")

</div>

> [@](#):
>
> \*Originally posted by ultrafilter \*  
> What I want to know is what change in x and y will cause the greatest _decrease_ in f. As I understand it, the gradient will tell me the direction of greatest change, but that could be an increase.

I don’t understand what you mean by cost function, so I could be way off base here. But the gradient is a vector that points in the direction of fastest increase. If you want the fastest decrease, you go in the opposite direction.

---

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [May 31, 2003, 3:31pm UTC](https://boards.straightdope.com/t/differential-equation-question-i-think/178678/12 "2003-05-31T15:31:07Z")

</div>

> [@](#):
>
> \*Originally posted by Achernar \*  
> \*\*I don’t understand what you mean by cost function, so I could be way off base here. But the gradient is a vector that points in the direction of fastest increase. If you want the fastest decrease, you go in the opposite direction. \*\*

:smack:

It still looks like the relationship between [symbol]D[/symbol]x and [symbol]D[/symbol]y restricts the solution to be only one point.

---

<div class="post-metadata">

**Author:** ![Q.E.D](https://avatars.discourse-cdn.com/v4/letter/q/51bf81/32.png) [@Q.E.D](https://boards.straightdope.com/u/Q.E.D)\
**Post date:** [May 31, 2003, 3:34pm UTC](https://boards.straightdope.com/t/differential-equation-question-i-think/178678/13 "2003-05-31T15:34:27Z")

</div>

I have both MathCad and Maple. Both can do differentials and integrals. I have no clue with this stuff, but you tell me how to enter the equations, I can get it to tell you the solution, I think.

---

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [May 31, 2003, 3:42pm UTC](https://boards.straightdope.com/t/differential-equation-question-i-think/178678/14 "2003-05-31T15:42:11Z")

</div>

Ask them to solve f(x, y) = [symbol]b[/symbol] and [symbol]D[/symbol]x = x[sub]0[/sub][symbol]D[/symbol]y/[symbol]a[/symbol] simultaneously. Use [symbol]D[/symbol]x = x - x[sub]0[/sub] and [symbol]D[/symbol]y = y - y[sub]0[/sub], just for consistency with my notation.

---

<div class="post-metadata">

**Author:** ![Desmostylus](https://avatars.discourse-cdn.com/v4/letter/d/c57346/32.png) [@Desmostylus](https://boards.straightdope.com/u/Desmostylus)\
**Post date:** [May 31, 2003, 3:51pm UTC](https://boards.straightdope.com/t/differential-equation-question-i-think/178678/15 "2003-05-31T15:51:28Z")

</div>

Why don’t you just look in a freakin’ _book_.

Like Chapter 10 of Press, Flannery, Tekolsky & Vetterling?

---

<div class="post-metadata">

**Author:** ![Desmostylus](https://avatars.discourse-cdn.com/v4/letter/d/c57346/32.png) [@Desmostylus](https://boards.straightdope.com/u/Desmostylus)\
**Post date:** [May 31, 2003, 4:00pm UTC](https://boards.straightdope.com/t/differential-equation-question-i-think/178678/16 "2003-05-31T16:00:54Z")

</div>

Or Press, Flannery, Te **u** kolsky & Vetterling, even.

---

<div class="post-metadata">

**Author:** ![Don\_Roberto](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@Don\_Roberto](https://boards.straightdope.com/u/Don_Roberto)\
**Post date:** [May 31, 2003, 5:39pm UTC](https://boards.straightdope.com/t/differential-equation-question-i-think/178678/17 "2003-05-31T17:39:38Z")

</div>

Do you want the direction of greatest decrease in f(x,y), or do you want the minimum of f(x,y), while also satisfying your cost function?

If it’s the latter, you can use Lagrange multipliers. To minimize a function f(x,y) subject to constraint c(x,y) = 0, solve the system of three equations in three unknowns (x,y,g):

c(x,y) = 0

df/dx + g\*(dc/dx) = 0

df/dy + g\*(dc/dy) = 0

If it’s the former, then I don’t think I understand the question.
