# In solving an op amp problem with two voltage sources, why can't we combine it?

Say we have a circuit like

Why can't we solve by doing $$V_{out} = -(V_{in} - V_{offset}) * (R_f / R)$$

We know that $V_{out}$ for a typical inverting amp (that doesn't have $V_{offset}$) is just $-(V_{in}) * (R_f / R)$, so why is $-(V_{in} - V_{offset}) * (R_f / R)$ for this diagram not correct?

My reasoning for $-(V_{in} - V_{offset}) * (R_f / R)$ is because we know $V_{offset}$ is the constant voltage for the positive side of the op-amp.

$V_{in}$ decreases until it reaches $V_{offset}$.

Thus, can't we just think of it equivalently as $-(V_{in} - V_{offset}) * (R_f / R)$?

There is a way to combine the solutions for the the two voltage sources using the Superposition Principle, which works for ideal opamp problems because they are Linear Systems.

Here is the general procedure for N voltage sources: Short all of the voltage sources except for one. Find the output voltage and call it Vo1. Iterate through the voltage sources, shorting each voltages source, and solving for the output voltages Vo1 through VoN. The total output voltage of the original circuit is the sum of each solved output: $$V_{out} = \sum_{i=1}^n Vo_i$$

@SpehroPefhany 's answer is the shorthand way to say all this, which is that each input has its own gain.

Do a 'sanity check' on your proposal. Set Vin = 0.

We know that Vout will be $V_{OUT} = +V_{OFFSET}(1+\frac{R_F}{R})$, which is not equal to what your equation yields: $V_{OUT} = +V_{OFFSET}(\frac{R_F}{R})$, so no you cannot.

The gain from the non-inverting input (Voffset) is higher than the magnitude of the gain from Vin.

If you want to subtract two voltages and have equal gain from each input what you do is add a voltage divider to the non-inverting input that is of the same ratio as the feedback network (R/Rf) and that reduces the overall gain from that input to Rf/R.

However if that voltage is fixed, you can save two resistors by simply adjusting the value of Voffset lower by that factor.

Why don't you just try a couple of simple examples and see if they are self-consistent to see that it is wrong.

For example $R = R_f, V_{in} = 1V, V_{offset} = 1V$ so that

$$-(V_{in} - V_{offset}) * (R_f / R) = 0$$ This result would indicate that the output is zero meaning that the inverting input must be at 0.5V since R and Rf are equal. The non-inverting input however is at 1V as defined by the problem. This 0.5V differential input is amplified by the gain of the opamp to give positive saturation. This is not consistent with the problem statement so the calculation must be wrong.

If you add $V_{offset}$ to the result it would be correct. One way of thinking about it that it would be the same as if the ground was elevated by $V_{offset}$.

$$-(V_{in} - V_{offset}) * (R_f / R) + V_{offset} = 1$$

By simple observation the inverting input would be at 1V, the non-inverting input is also at 1V and the output is at 1V.

This is self-consistent.

Perhaps you were thinking that both voltage sources are in series: Vin-GND-Voff. If this were true, you would be right!

However, they are not in series because there is another element connected to GND: The source that models the OpAmp output has also one terminal connected to GND. Drawing the OpAmp symbol with one leg to GND (or showing the power connections explicitly) explicitly shows where the output current comes from and avoids making false assumptions.