Opamp Inverting Amplifier: The case of non-inverting input not being connected to ground
You can verify it using the common techniques for ideal opamps:
1) Having negative feedback makes the voltages on both terminals equal
2) There is no current flowing into or out of the terminals.
So, if \$I\$ is the current flowing through \$R_i\$ and \$R_f\$, $$V_n=V_p$$ $$I=(V_n-V_i)/R_i=(V_o-V_n)/R_f$$ Rearranging: $$V_o=\frac{R_f}{R_i}(V_n-V_i)+V_n=\frac{R_f}{R_i}(V_p-V_i)+V_p = -\frac{R_f}{R_i}V_i+\frac{R_f+R_i}{R_i}V_p$$ Which is exactly your formula.