# How to find maximum (derivative)

#### Jony130

Joined Feb 17, 2009
5,457
Can you help me finding the value of an R2 resistor to get the maximum "voltage range" the output?

We have the voltage divider and the upper resistor changes his resistance value from Rmin to Rmax.
And I want to find the lower resistor value (R2) that gives me the larges output voltage "swing".

$V_{DIFF} = V_{CC} * \frac{R_2}{R_2 + R_{min}} - V_{CC} * \frac{R_2}{R_2 + R_{max}}$

$V_{DIFF} = V_{CC} *\left( \frac{R_2}{R_2 + R_{min}} - \frac{R_2}{R_2 + R_{max}}\right)$

$\frac{V_{DIFF}}{V_{CC}} = \frac{R_2}{R_2 + R_{min}} - \frac{R_2}{R_2 + R_{max}}$

And I think the question is how to find the derivative of this function?

#### Papabravo

Joined Feb 24, 2006
20,399
It is not clear to me what you mean by voltage swing. Isn't this a DC circuit?

#### Jony130

Joined Feb 17, 2009
5,457
Yes, it is a DC voltage. I want to choose R2 resistor so I can get the largest possible change in the output voltage (voltage divider output voltage) for a given change in resistance in the upper resistor ( Rmin and Rmax).

#### Papabravo

Joined Feb 24, 2006
20,399
Yes, it is a DC voltage. I want to choose R2 resistor so I can get the largest possible change in the output voltage (voltage divider output voltage) for a given change in resistance in the upper resistor ( Rmin and Rmax).
So in this problem, what are the variables and what are the constants. What are we taking the derivative with respect to?

#### Jony130

Joined Feb 17, 2009
5,457
R2 and Vcc are the constants

$V_{O_{MAX}} = \frac{R_2}{R_2 + R_{min}}$

$V_{O_{MIN}} = \frac{R_2}{R_2 + R_{max}}$

$V_{DIFF} = V_{O_{MAX}} - V_{O_{MIN}} = V_{CC} *\left( \frac{R_2}{R_2 + R_{min}} - \frac{R_2}{R_2 + R_{max}}\right)$

And I want to find the R2 resistor value so I can get the largest possible change in the output voltage for a given change in resistance in the upper resistor ( Rmin and Rmax).

Last edited:

#### Papabravo

Joined Feb 24, 2006
20,399
So the function V_DIFF is a function of two variables R_min and R_max is that correct?

#### Jony130

Joined Feb 17, 2009
5,457
So the function V_DIFF is a function of two variables R_min and R_max is that correct?
Yes, it look like it is.

#### Papabravo

Joined Feb 24, 2006
20,399
I think the problem is indeterminate because you have two variables and only one condition. That usually means there are an infinite number of solutions and no unique one.

#### Jony130

Joined Feb 17, 2009
5,457
I think that I got it wrong. And I wrongly explain it to you.

The R2 value is what I want to know so it must be a variable and Rmin and max are the constants.

Because I know the Rmin and Rmax values and Vcc and I want to find R2 value so I can get the latest voltage change at the output.
For example:
Rmax = 100kΩ and Rmin = 10kΩ and Vcc = 10V
I can use a WolframAlpha to plot the function for me:

https://www.wolframalpha.com/input/?i=plot+10*(X/(X+++10)+-+X/(X++100)+)+for+X+=+0+to+X+==100

So there must be a way (I may be wrong) to solve for R2 in symbolic form.

#### MrChips

Joined Oct 2, 2009
29,246
For example:
Rmax = 100kΩ and Rmin = 10kΩ and Vcc = 10V
Max range occurs when R2 = 31.5kΩ

#### MrAl

Joined Jun 17, 2014
10,612
R2 and Vcc are the constants

$V_{O_{MAX}} = \frac{R_2}{R_2 + R_{min}}$

$V_{O_{MIN}} = \frac{R_2}{R_2 + R_{max}}$

$V_{DIFF} = V_{O_{MAX}} - V_{O_{MIN}} = V_{CC} *\left( \frac{R_2}{R_2 + R_{min}} - \frac{R_2}{R_2 + R_{max}}\right)$

And I want to find the R2 resistor value so I can get the largest possible change in the output voltage for a given change in resistance in the upper resistor ( Rmin and Rmax).

View attachment 207880
Hi,

I get two solutions:
R2=-sqrt(Rmax*Rmin)
R2=sqrt(Rmax*Rmin)

You may only want the positive one.

#### Deleted member 115935

Joined Dec 31, 1969
0
A time old engineers hack,

try a spread sheet, put some values in, see what happens if you increase or decrease,

#### MrAl

Joined Jun 17, 2014
10,612
A time old engineers hack,

try a spread sheet, put some values in, see what happens if you increase or decrease,

Hi,

Well, once you find the symbolic solution:
R2=sqrt(Rmax*Rmin)

you dont have to do any experiments to find the result you just plug in the two values say Rmax=100 and Rmin=10 and get:
R2=sqrt(100*10)=31.623 approximate

In fact, if we substitute that symbolic solution of R2 into the original equation we get:
VmaxDiff=((sqrt(Rmax)-sqrt(Rmin))*Vcc)/(sqrt(Rmin)+sqrt(Rmax))

and with values Rmax=100 and Rmin=10 again and Vcc=10 we get:
VmaxDiff=((10-sqrt(10))*10)/(sqrt(10)+10)
or:
VmaxDiff=0.51949385329592*10=5.1295 approximate.

That's the beauty of a symbolic solution it leads to a very straightforward calculation. We cant always find that nice of a solution, but when we can it makes things simpler in many cases.

#### atferrari

Joined Jan 6, 2004
4,701
A time old engineers hack,

try a spread sheet, put some values in, see what happens if you increase or decrease,

Isn´t what in a certain way you do with Solver? I could be dead wrong, I know.

#### ci139

Joined Jul 11, 2016
1,874
. . .
so basically your $$\downarrow\ \downarrow$$ becomes
$V_{DIFF} = V_{O_{MAX}} - V_{O_{MIN}} = V_{CC} *\left( \frac{R_2}{R_2 + R_{min}} - \frac{R_2}{R_2 + R_{max}}\right)\\{\ }\\ _\text{Renaming the variables : } \Delta V=V_{DIFF}\ ,\ V_S=V_{CC}\ ,\ R_0=R_{MIN}\ ,\ R_1=R_{MAX}\\{\ }\\ \Delta V=V_S·\left({\frac1{1+\frac{R_0}{R_2}}-\frac1{1+\frac{R_1}{R_2}}}\right)\\{\ }\\ d\Delta V=V_S·\left({\frac{\frac{R_0}{R_2^2}}{\left({1+\frac{R_0}{R_2}}\right)^2}-\frac{\frac{R_1}{R_2^2}}{\left({1+\frac{R_1}{R_2}}\right)^2}}\right)\\{\ }\\ d\Delta V=0 \leftarrow _\text{ gives you the values to check for . . . so basically ::}\\{\ }\\ \frac{\frac{R_0}{R_2^2}}{\left({1+\frac{R_0}{R_2}}\right)^2}=\frac{\frac{R_1}{R_2^2}}{\left({1+\frac{R_1}{R_2}}\right)^2}\\{\ }\\ R_2=\sqrt{R_0·R_1}$