An OpAmp tries to keep V+ = V- (the non-inverting and inverting inputs, respectively).
V- = V+ = U1.
An OpAmp has zero input current (well, almost zero), therefore I(R1) = I(R2).
I(R1) = E/R = (U2 - V-)/R1
I(R2) = E/R = (V- - UT)/R2
Substituting U1 for V- and equating the two currents,
(U2 - U1)/R1 = (U1 - UT)/R2
R2U2 - R2U1 = R1U1 - R1UT
Solving for UT,
UT = -(R2U2 - R2U1 - R1U1)/R1
UT = U1(R1+R2)/R1 - U2R2/R1
UT = U1(1 + R2/R1) - U2(R2/R1)
Which is the superposition of the inverting gain and non-inverting gain formulas.
This is one of the Quizzes I would give my junior EE job applicants. You would be surprized how many fell on their ass!