Confused about op amp equation derivation
You didn't explain how 4-1 arrived. But 4-1 isn't at all intuitive. A much better way to see it is to require (obviously) that the (+) and (-) inputs to the opamp are equal to each other. Like this:

$$\frac{V_\text{OUT}\cdot R_\text{G}+V_\text{IN}\cdot R_\text{F}}{R_\text{F}+R_\text{G}}=V_\text{REF}\cdot \frac{R_\text{F}}{R_\text{F}+R_\text{G}}$$

The left side is the equation for the (-) input node. The right side is the equation for the (+) input node. Just set them equal to each other (on the assumption that the designer wasn't an idiot and didn't get the input nodes reversed.)

The denominators on both sides cancel, immediately, and the solution is:

$$V_\text{OUT}=\left(V_\text{REF}-V_\text{IN}\right)\cdot\frac{R_\text{F}}{R_\text{G}}$$

In case you are wondering (and you shouldn't be because it should be as automatic as breathing is to you), any pair of voltage sources separated by two resistors will have the middle node voltage determined by an expression of the exact same topology as the left side of the first equation.

To make this clear, examine:







simulate this circuit &ndash; Schematic created using CircuitLab

$$V=\frac{V_\text{A}\cdot R_\text{B}+V_\text{B}\cdot R_\text{A}}{R_\text{A}+R_\text{B}}$$

This always works. (You should memorize it.) Sometimes, one of the voltages (with reference to ground) is \$0\:\text{V}\$. In those cases, the above equation simplifies a bit. But it is otherwise something to memorize.

So the topology simplifies into the right side voltage divider topology when either one of the voltage sources is assigned the value zero. (In the right hand expression of the first equation, that source was "ground," which is why it looks simpler. But in reality it is the same, more general equation as on the left side -- just that on the right side one of the sources was zero.)

So the above approach is obvious and very easy to understand. It's just two pairs of voltage dividing resistor equations set equal to each other. You are just lucky that one of four sources is ground. There's nothing at all difficult to explain about it. All the questions about odd factors just disappear.

I'll be happy to explain the factor you mentioned the moment you provide us with the logical flow used to develop 4-1. (Barry already provided you with an explanation you may like, though.)