The question is to determine the voltage \$v_1\$,\$v_2\$,\$v_3\$. The directions of various currents flow in the diagram above were given by the solution. By applying KCL at the supernode, \$2=v_1+2(v_1-v_3)+8(v_2-v_3)+4v_2\$ But in my attempt, the direction of current flow I assumed between node \$v_2\$ and \$v_3\$ is opposite to the direction given in the diagram above, and the equation I got is different: \$2=v_1+2(v_1-v_3)+8(v_3-v_2)+4v_2\$ Which lead to a wrong answer, different as compared to the solution given. Could someone please explain why is it so?
There are many ways to write the sum of currents of a node:
Sum of currents out of a node:
The diagram definition give the equation: \$ -2 + v_1 + 2(v_1 - v_3) + 8(v_2 - v_3) + 4v_2 = 0\$
The current source direction is opposite, therefore a negative sign is added on.
Sum of current in = Sum of current out:
\$ 2 = v_1 + 2(v_1 - v_3) + 8(v_2 - v_3) + 4v_2 \$
That is the exact same equation you listed.
This is just a long winded way of saying if the current flow is opposite, then you either put a negative sign in for it, or put it on the other side of the equation.
Therefore with your definition of current going from v3 to v2, one way to write the equation is:
\$ 2 = v_1 + 2(v_1 - v_3) - 8(v_3 - v_2) + 4v_2 \$
That is, of course, equivalent to the previous two equations.