As you leaned in the intro to opamps, when under negative feedback, the
voltage difference across its inputs will be close to 0v. This is
achieved via compensation from the opamp output & the feedback loop.
In the simplest way to achieve it is a configuration known as the
inverting amplifier. In this configuration, the non inverting input is
tied directly to ground, & a feedback loop is made using a resistor
connected between inverting input & output.
Another resistor is used to connect the signal source to the amplifier,
since the inverting input will be at the same potential by action of the
feedback loop, it would be connected to ground & no signal would get
to the opamp to get amplified.
The voltage in through the resistor will cause a current going in the
direction of the inverting input. Since one of the properties of the op
amp is that its inputs draw virtually no current, or at least it will
try not to draw current by pulling the output voltage towards a more
negative value, in order to create a voltage across the feedback
resistor that will draw the same amount of current as what's trying to
go through the input resistor.
The math behind this action:
Vrin = Vin - Vinv
The inverting terminal is at the same potential as the non inverting, which is tied to ground, so:
Vrin = Vin
Then separate Vrin into current times voltage, according to ohm's law:
IinRin = Vin => Iin = Vin/Rin
Now you get an equation for the current in. Since the input will not draw current, we have that
Iin = Ifb, Ifb is the feedback current.
Ifb = (Vinv - Vout)/Rfb
Again, Vinv is tied to ground similar to the non inverting, so
Ifb = (0 - Vout)/Rfb => -Vout/Rfb
We equal both currents to get an equation in terms of only voltages & resistors
Iin = Ifb => Vin/Rin = -Vout/Rfb
The variable of interest is Vout, so rewrite it in terms of Vout
(Vin/Rin)Rfb = -Vout => -Vin(Rfb/Rin) = Vout
From this last equation you can see that the output voltage will be an
inverted version of Vin multiplied by the ratio of the input resistor & the feedback resistor; increasing the input resistor gives less
gain, while increasing the feedback resistor increases gain.