This inverting-gain-is-resistor-ratio lesson treats the inverting node as an ideal virtual ground, so input current through one resistor must be supplied through the feedback resistor. The 2 V over 2 ohm input current and 6 ohm feedback resistor give -6 V exactly only for the stated ideal op-amp model. Real op-amps add finite gain, offset, bias current, bandwidth limits, slew rate, rail limits, resistor tolerances, and measurement uncertainty.
An inverting op-amp output follows from the input current through feedback resistance. Exact arithmetic here means exact results for the stated model inputs; measured inputs still carry uncertainty and significant-figure limits.
highlighted = computed this step
The input resistor sets the current
The input is 2 volts across 2 ohms, so the input-resistor current is 1 ampere.
I=2ohm2V=1A
The output moves negative through the feedback resistor
The same current through 6 ohms requires -6 volts at the output.