>> This amplifier circuit is referred to as a difference amplifier.
As the name suggests, we're going to see that at the output,
we're going to find the difference or the subtraction of V2 and V1 or V2 minus V1.
Before we get started on this circuit,
and before you analyze this circuit,
let's just make a few observations.
First of all, in the circuit that we've analyzed involving Op-amps until now,
the sources have been on either the inverting terminal,
or the non-inverting terminal.
This configuration has sources V1 connected to the inverting terminal and V2
connected to the non-inverting terminal albeit through
this resistive network before it gets to the non-inverting terminal.
That points out the fact that VP,
the voltage at the inverting terminal is not exactly V2.
So, what effect is this resistive network have?
Well, we know that the current going into the input of the Op-amp is zero.
Therefore, any current coming from V2 going through R3 will also go through R4.
R3 and R4 are in series with each other,
we have a voltage divider taking place here.
Thus, the voltage at the non-inverting terminal is the voltage across to R4.
It's not exactly V2 but a subdivided portion of V2.
Lets just go ahead and make that observation,
we'll do it up here because we need to keep room,
this is a fairly long derivation.
Let's just say that V sub p,
the voltage of the non-inverting terminal is going to equal
V2 times R4 over R3 plus R4.
So, V sub p is just a little less than V2.
Now keeping in mind, we have the virtual short between the terminals,
that then means that V sub n is equal to V sub p which is equal to that.
This should give us a little bit of flavor of what's going on here.
We know that sources connected to
the non-inverting terminal in our non-inverting amplifier configuration had a gain
that is slightly larger than
the gain experienced by sources connected to the inverting terminal.
The non-inverting gain was one plus R2 over R1,
whereas the inverting gain was negative of course,
just R2 over R1.
So, this voltage divider circuit is intended to
reduce V2 down just a little bit so that at the output,
V2 and V1 will experience the same gain,
and this circuit then we'll implement a true subtraction.
All right. So, with that,
let's go ahead and start our analysis of this by doing
exactly what we've done in the other circuits involving amplifiers,
and that is write a node equation summing the currents leaving the inverting terminal.
Again, we'll do it in terms of V sub n until we get things simplify then will substitute
V sub n for V sub p which is going to be V2 times R4 over R3 plus R4.
So, KCL at the node.
We got the current leaving the node going this way.
That's going to be V sub n minus V1 divided by R1,
plus the current going this way through the feedback loop is going to be,
and we're adding that in,
V sub n minus Vout divided by R2.
There's no current going into the inverting terminal,
so we only have those two terms that must add to give us zero.
Now, combining terms and factoring out the V sub n,
then we've got V sub n times one over R1 plus one over R2,
and then we have minus V1 over R1.
We still have this minus Vout over R2,
lets take it to the other side as a positive, Vout over R2.
Now, let's get a common denominator here.
So, we have V sub n times R1 plus R2 over R1 times R2,
minus V1 over R1 equals Vout over R2.
Now, we're going to multiply both sides of the equation by R2,
to solve for Vout and we'll reverse the order of the equation.
We're left with then Vout is equal to,
multiplying both sides by R2,
we have an R2 here that's kind of cancel that R2.
So, we're left with then V sub n times R1 plus R2 over R1,
minus V1 times R2 over R1.
Okay, so we've got the two terms.
We have the inverting term here,
V1 times R2 over R1.
We have V sub n,
now we need to replace V sub n with V2 over
R4 over R3 plus R4 so that we can see the dependency of the output on V2.
Let's do that on up here.
We've got the Vout is equal to V sub n,
then V sub n is equal to V2 times R4 over R3 plus R4.
So that's V sub n times R1 plus R2 over R1.
That's our first term, minus V1 times R2 over R1.
Thus, we see that we have different gain terms.
We've got this multiplying effect here,
minus V1 times R2 over R1.
We've got a couple more steps to take until we get there,
but let's be explicit and show all of our work here.
First of all, let's notice that this term here R1 plus R2 over R1,
R1 is a common denominator to both of them.
That then gives us,
if we identify that as such,
let's just write this then as R4 over R3 plus R4,
times R1 over R1.
That's just one plus R2 over R1,
minus V1 times R2 over R1.
We see that this term right here really is just
that the gain term for the non-inverting amplifier,
there's the gain term for the inverting amplifier.
Here's this voltage divider term which is taking V2 and subdividing it just a little bit.
Now, what we want to do is determine the relationships between R1, R2, R3,
and R4 that will make it so that this gain term right here,
multiplying V2, is the same as the gain term
multiplying V1 with the obvious exception that V1 it's got the minus sign on it.
All right. In order to do that,
we're going to factor in R3 out of the denominator of this term right here.
So, we have then equals
V2 factoring in R3 out and I'm also going to bring the R4 out in front.
So, we'll have, let's see,
R4 over R3 times one
over factor in the R3 that leaves
as a one plus factoring in R4 out there it leads me to R3,
refactoring R3 out of this term here leaves me
an R3 in the denominator or I have a R4 over
R3 times one plus R2 over
R1 minus V1 times R2 over R1.
Kind of a mess but we've got this V2 times R4 over R3 then
multiplying this one divided by one plus R4 over R3.
Then multiplying this one plus R2 over R1.
Just a second, I'm going to ask you to stop the video.
Let me observe first of all,
that this gain term here will equal this gain term here,
if the ratio of R4 over R3 equals the ratio of R2 over R1.
If the ratio R4 over R3 equals R2 over R1,
then this term here in the denominator is the same as
this term here in the numerator and they will cancel.
We're left with simply then Vout is equal
to V2 times again R4 over R3 equals R2 over R1.
So, let's replace it here also, R2 over R1,
minus V1 times R2 over R1.
Now, if we factor out this R2 over R1,
we get then and this is where we've been trying to get this whole way.
Vout then is equal to R2 over R1 times V2 minus V1.
From here, you can see then why this is called a difference amplifier.
The output voltage is equal to a scaled version of
this source voltage minus this source voltage.
The usefulness of this amplifier configuration can't be overstated.
What this allows us to do and it's sometimes
also referred to as a differential amplifier.
It allows or this circuit will sample voltages at
two different points in a circuit and subtract one from the other.
In control circuits, this comparison is used to or they'll
wraps circuitry around it to drive that difference to zero.
This type of an amplifier becomes the core of
feedback systems or control systems where
one voltage is meant to control another voltage.
It also performs the obvious operation of taking one source and
subtracting it from another or adding in depending upon the size of the V1 and V2.
So, if I would say for now this is a very useful amplifier configuration
and you'll see more of it as you go on with
this course and then also into your linear electronics classes.