# Solve a circuit with the nodal analysis (1)

I have the following circuit...

...and I want to find Vo with the nodal analysis.

At node 1 (V1):

V1 + 40 + (V1-Vo)/2 + 5 = 0
2V1 + 80 + V1 - Vo + 5 = 0
3V1 - Vo = -85


At node 2 (Vo):

(V1-Vo)/2 + 5 + (Vo+20)/8 + Vo/4 = 0
4V1 - 4Vo + 40 + Vo + 20 + 2Vo = 0
4V1 - Vo = -60
Vo = 4V1 + 60


Then V1:

3V1 - 4V1 - 60 = -85
V1 = 25 V


And Vo:

Vo = 4V1 + 60 = 4*25 + 60 = 160 V


But something is wrong, because the solution is Vo = 27.27 V (source).

• where is v1 and what are node 1 and node 2? Jan 15 '16 at 15:32
• @PlasmaHH Check the new image!
– ᴜsᴇʀ
Jan 15 '16 at 15:46
• In first equation for node 1, it should have been v1-40 because you're assuming ground at bottom and 40V is positive on upper side. Also you messed up the direction of currents in both nodes. If entering currents are positive, leaving currents should be negative. Like this (V1-Vo)/2 + 5 - (Vo+20)/8 - Vo/4 = 0. Now solve it Jan 15 '16 at 16:00
• Are you sure the answer is correct? I've corrected your node equations but I'm getting v0 = 20 and v1 = 30 Jan 15 '16 at 16:01
• He didnt add voltages and currents, he merely didnt show his division by 1 ohm i.e. (v1 - 40) / 1 Jan 15 '16 at 16:03

Seems like it is hard to keep the directions consistent. I find that it is always useful to keep the following picture in my mind:

and from this, if the unit is a resistor: $$i = \frac{v_{+} - v_{-}}{R}.$$

Decide if you want to use current into or out of each node. I usually prefer out of, which means that the voltage at the node is always the first term ($v_{+}$). This gives: $$\frac{\color{red}{v_1}-40}{1} + \frac{\color{red}{v_1}-v_2}{2} + 5 = 0, \\ \frac{\color{green}{v_2}-v_1}{2} + \frac{\color{green}{v_2}-0}{4} + \frac{\color{green}{v_2}-(-20)}{8}-5=0,$$ This is easily solved. You could use a calculator or a math program, or you could do it by hand, for instance by multiplying the first equation by 2 and the second by 8: $$\begin{eqnarray} 2v_1-80+v_1-v2+10 = 0\\ 4v_2-4v_1+2v_2+v_2+20-40=0 \end{eqnarray}$$ so $$\begin{eqnarray} 3v_1 - v_2 - 70 &=& 0, \qquad(1)\\ -4v_1 + 7v_2 - 20 &=& 0, \qquad(2) \end{eqnarray}$$ or $$\begin{pmatrix}3 & -1\\-4&7\end{pmatrix}\begin{pmatrix}v_1\\v_1\end{pmatrix}=\begin{pmatrix}70\\20\end{pmatrix},$$ keeping in mind that the determinant is $3\cdot7-(-1)(-4)=17$, $$\begin{pmatrix}v_1\\v_2\end{pmatrix} = \begin{pmatrix}3&-1\\-4&7\end{pmatrix}^{-1}\begin{pmatrix}70\\20\end{pmatrix} = \frac{1}{17}\begin{pmatrix}7&1\\4&3\end{pmatrix}\begin{pmatrix}70\\20\end{pmatrix}=\begin{pmatrix}{30\\20}\end{pmatrix}.$$ So, $v_o = v_2 = 20 V$.

I don't think your solution 27.27 V is correct. After correcting your equations, i'm getting:

Current leaving node 1

(V1 - 40)/1 + (V1 - Vo)/2 + 5 = 0
2V1 - 80 + V1 - Vo + 10 = 0
3V1 - Vo = 70
Vo = 3V1 - 70   ...... (1)


Current entering node 2

(V1 - Vo)/2 + 5 + (-20 - Vo)/8 + (-Vo)/4 = 0
4V1 - 4Vo + 40 - 20 - Vo - 2Vo = 0
4V1 - 7Vo = -20  ..... (2)


Substituting (1) into (2)

4V1 - 7(3V1 - 70) = -20
4V1 - 21V1 + 490 = -20
17V1 = 510
V1 = 30 V


Substituting V1 into (1)

V0 = 3(30) - 70 = 20 V

• +1 Agree with this- the original solution is wrong. Maybe they flipped the 20V source or something like that. Jan 15 '16 at 16:16
• oops! sorry, you have already answered. But two answers confirm so 27.27 would definitely be wrong. Jan 15 '16 at 16:18
• @SpehroPefhany About the original solution see here.
– ᴜsᴇʀ
Jan 15 '16 at 16:32
• I understood that I did not really understand how to behave when in a single branch there are both a voltage generator and a resistance. Why in node 1 is (V1 - 40)/1, and in node 2 is (-20 - Vo)/8 and (-Vo)/4?
– ᴜsᴇʀ
Jan 15 '16 at 16:40
• To get currents leaving a node, we subtract other voltages from the node voltage. So the (v1 - 40)/1 represents the current leaving node 1 along that branch (e.g. if v1 was 50v, then the current would be (50 - 40) / 1 = 10 A leaving towards ground). To get currents entering the node, we subtract the node voltage from other voltages, so (-20 - Vo)/8 stands for the current entering node 2 from the 8 ohm branch, given that the voltage after the resistor is -20 v (20 V below ground). Jan 15 '16 at 17:04

Here is the corrected version of the original 'solution'.

At node 1 (V1): $$V_{1} - 40 + \frac{(V_{1}-V_{o})}{2} + 5 = 0$$ $$2V_{1} - 80 + V_{1} - V_{o} + 10 = 0$$

$$3V_{1} - V_{o} = 70$$

At node 2 (Vo):

$$\frac{(V_{1}-V_{o})}{2} + 5 - \frac{(V_{o}+20)}{8} - \frac{V_{o}}{4} = 0$$ $$4V_{1} - 4V_{o} + 40 - V_{o} - 20 - 2V_{o} = 0$$ $$4V_{1} - 7V_{o} = -20$$ $$V_{o} = \frac{(4V_{1} + 20)}{7}$$

Then V1:

$$3V_{1} - \frac{(4V_{1} + 20)}{7} = 70$$ $$17V_{1} = 510 V$$ $$V_{1}=30$$

And Vo: $$V_{o} = \frac{(4V_{1} + 20)}{7} = \frac{(4\times30 + 20)}{7} = 20 V$$