Calculate voltage over resistor
The problem is solved by the same equation.

Assume Va, Vb and Vc are the voltages at the nodes shown in the following schematic:







simulate this circuit &ndash; Schematic created using CircuitLab

then you have:

$$
V_c - V_b = \frac{R_2}{R_1+R_2} \cdot (V_a - V_b)
$$

Rearrange as you see fit and plug-in your numbers to see that it works in both cases (and be careful when handling the sign of the voltages).

Note that in your last case, \$V_c - V_b\$ is to be identified with \$V_3\$, whereas in your first case \$V_2\$ is the same as \$V_c\$.