I'm a computer science student and am taking a basic electrical circuits course. I'm facing many difficulties, but the one that I want to address here regarding nodal analysis and determining whether or not resistors are in series or parallel. I decided to use a specific problem example from my textbook.

  1. Regarding assigning direction for currents, I noticed that in many cases currents aren't initially given and the reader has to "draw" them on (as I did for I1 and I2 and I3). My question is, how do we know which direction to assign them to?
  2. My next question has to do with combining resistors. I understand the concept of how to combine resistors when they're in series or parallel, but I'm not sure how to determine that in the first place. For example, if resistors are connected like first and second resistors starting from the far left side, are these two resistors in series? enter image description here Any help would be greatly appreciated. Thank you!
  • \$\begingroup\$ Persist. You are training your brain, using visual abstractions, to model and manage phenomena. The abstractions were developed over 250 years by mankinds best philosophers. Back up and work with very simple circuits. Persist. The brain needs low stress and 12 hour cycles of learning mixed with rest and relaxation. Then revisit the circuits. \$\endgroup\$ Apr 23, 2017 at 17:31

3 Answers 3


My question is, how do we know which direction to assign them to?

You can pick whichever direction you like. If you're "wrong" then when you solve the circuit you'll just end up with a negative value.

For example, if resistors are connected like first and second resistors starting from the far left side, are these two resistors in series?

They're neither. (If you solve the circuit by superposition you might find that for part of the solution they are in series)

Two components are in series if all the current that flows through one must flow through the other.

They're in parallel if the same voltage is applied across them.

There are lots of ways to combine components that are neither series nor parallel.

  • \$\begingroup\$ Can I really chose the direction of the current regardless of the presence of a voltage/current source ? For example can I choose the left-to-right and top-to-bottom directions for every component in the circuit ? \$\endgroup\$
    – Bemipefe
    Nov 19, 2019 at 11:41
  • 1
    \$\begingroup\$ @Bemipefe, yes, you can. You just have to keep track of how it affects the signs of the various terms in your node or mesh equations, and how the sign of your results then relates to the actual directions of currents or voltages in the circuit. \$\endgroup\$
    – The Photon
    Nov 19, 2019 at 21:50

I used to teach computer science at the largest 4-yr university in my state as an adjunct professor and my best students in these classes (typical sizes were about 75 students per class) were consistently the few of them who were coming in from the EE side and taking computer science courses (typically there would be 6 of the 75 students from EE or CE, with the rest going for CS.) [I came from physics and mathematics. But there's no money in it so instead I made money through starting several software companies and products.]

I really wish that every CS student was required to take some of the same EE coursework as part of their degree process and I think it's great that you are electing to do so on your own! You are one of the unusual CS students doing that and if I were hiring I would definitely look very favorably on the fact that you took EE courses. It says something important to me. Just wanted to mention that and encourage you to press on a bit, if you feel it doesn't harm the rest of what you are doing as well.

As a CS student, you should be aware that there is a schematic editor included with this site's question and answer editor system. You can see the icon when you are editing/writing. I'll use it now to place your schematic below:


simulate this circuit – Schematic created using CircuitLab

  1. Regarding assigning direction for currents, I noticed that in many cases currents aren't initially given and the reader has to "draw" them on (as I did for I1 and I2 and I3). My question is, how do we know which direction to assign them to?

There is no right way. It's arbitrary. Whatever choice you make, you stick with it when writing out your equations. When you finally solve your equations, quantitatively, it will turn out that if the sign of the quantity is positive then your arbitrary assignment turned out to match the results (and you can just write that positive value next to the arrow); and if the sign of the quantity is negative then you either put the negative value next to the arrow or else you reverse the arrow and write the absolute value next to the newly reversed arrow.

Even computer software like spice doesn't care about "guessing" directions, per se. Instead, spice is consistent. (If you use a spice program that includes a schematic editor, you will find that it always treats the current direction in a resistor by default as going from "pin 1" to "pin 2", without really caring what it looks like on the schematic.) Spice doesn't care about the schematic pictures you are staring at. It just cares about being consistent.

Just so long as you are consistent in the math you apply, the results are consistent and equivalent. It's only us humans who have to pause a moment and think about current as having direction on a schematic image. To a computer program, it's just positive and negative values applied consistently using correct theory.

Don't get too bogged down in worrying over this. Take out a schematic (like the one above) and solve it using differently directed arrows for the currents, salted out at random. Do this three times, let's say. And solve it. I think you'll then get the point.

  1. My next question has to do with combining resistors. I understand the concept of how to combine resistors when they're in series or parallel, but I'm not sure how to determine that in the first place. For example, if resistors are connected like first and second resistors starting from the far left side, are these two resistors in series?

Two-terminal parts are "in series" if and only if they share exactly one node between themselves (and that node is otherwise unshared) and the remaining two terminals span between two different circuit nodes. Two-terminal parts are "in parallel" if and only if not one but both their terminals are shared and these two terminals span between two different circuit nodes.

[You'll find later that there are times when you get to mentally "replace" two terminal parts with dead shorts or an open hole (removing the part, entirely.) But that's for different things. So just keep it in mind so you won't be surprised when you see someone doing that.]

Now. In your circuit, there are a couple of immediate "cheats" to do.

  • One is that you are always allowed to select one node and assign it zero volts. This is sometimes called "common" or "ground." (Ground can have an additional meaning due to the way that the power grid is delivered in some countries... but that's another long tale.) So, in your case I added a ground symbol at the bottom and labeled that node as \$0\:\textrm{V}\$, arbitrarily. You get to do that only once. Everything else will be "referred to" that point, when discussing voltages.
  • Another is that because you have a nice voltage source, \$V_{99}\$, referenced directly to the common node at bottom, it's trivial to figure out that \$V_3=+12\:\textrm{V}\$. So that's solved, already. This just leaves you two nodes whose voltages you need to figure out.

At this point, there are a number of different analytical tools you can apply to figure out the rest.

Getting back to your thoughts about series/parallel: Your circuit does not have any obvious series resistor pairs or parallel resistor pairs in it. But if you know about Thevenin or Norton equivalents, then you could do the following steps to find some:


simulate this circuit

If you follow the steps, you can see that along the way there are series pairs and parallel pairs of resistors that are combined. So, in that sense, perhaps there are some things you could do using those ideas. But the above is really nothing more than wasted exercise. (Well, it can be useful too. But I think in this case it leads you around the barn, so to speak.) What you really want are the remaining node voltages so that you can figure out anything else you want. (If you have those, the rest just falls out easy.) So nodal analysis is a powerful way to go.

For each node, "imagine" that you are sitting in the middle of the node (which is like a flat, small, square floor sitting at some elevation you don't yet know on a long pole from "down there somewhere.") Water is spilling from above onto your floor. You don't know from how high, but you can tell it's spilling down onto your floor. Also, the water that hits your small floor now flows off the edges and spills down onto other floors below yours. You don't know where those are at, either. But you know they must be there. (The "water" is current, the heights of things is voltage.)

Let's write an equation from the perspective of sitting on the floor called \$V_1\$:

$$\begin{align*} \frac{V_1}{R_1}+\frac{V_1}{R_2}&=2\:\textrm{mA}+\frac{0\:\textrm{V}}{R_1}+\frac{V_2}{R_2} \end{align*}$$

The left side represents the currents spilling outward and away from your floor, node \$V_1\$, and onto other nearby floors. (It cannot spill outward in opposition to current source \$I_1\$, since that current source is pointing into your node [floor.]) The right side represents the currents spilling inward and onto your floor from other nearby floors. (In this case, you do include \$I_1\$ since it points into node \$V_1\$.)

The additional equation is for node \$V_2\$, handled now with its own perspective:

$$\begin{align*} \frac{V_2}{R_2}+\frac{V_2}{R_3}+\frac{V_2}{R_4}&=\frac{V_1}{R_2}+\frac{0\:\textrm{V}}{R_3}+\frac{12\:\textrm{V}}{R_4} \end{align*}$$

That's it. The left side of each equation is just a sum of the outward going currents through all of the paths available; and the right side of each equation is just a sum of all the currents flowing back inward, coming through all of the paths available. Clearly, since currents can't accumulate in a node, these two must balance out (be equal to each other.) So you now just solve those two equations simultaneously:

$$\begin{align*} \left(\frac{1}{R_1}+\frac{1}{R_2}\right)\cdot V_1+\left(\frac{-1}{R_2}\right)\cdot V_2&=2\:\textrm{mA}\\\\ \left(\frac{-1}{R_2}\right)\cdot V_1+\left(\frac{1}{R_2}+\frac{1}{R_3}+\frac{1}{R_4}\right)\cdot V_2&=\frac{12\:\textrm{V}}{R_4} \end{align*}$$

And if you plug in the values and solve you will have \$V_1=3.6\:\textrm{V}\$ and \$V_2=5.2\:\textrm{V}\$. From those, you can compute currents to your heart's content.

I strongly urge you, given your CS background, to pursue a copy of "SPICE2: A Computer Program to Simulate Semiconductor Circuits" by Laurence W. Nagel, Memorandum No. UCB/ERL M520, 9 May 1975. This can be gotten from the Electronics Research Laboratory, College of Engineering, University of California, Berkeley, CA, 94720. It includes CS-perspectives on solving circuit problems, which you will NOT find in any EE textbook or online web page that I'm aware of. It illustrates a number of different theoretical approaches and documents thoroughly the numerical methods problems (from a CS perspective) and relative execution times for a variety of techniques. It's very good and a uniquely valuable resource in helping a CS student understand how to approach circuits (again, from a CS perspective.) Nothing better I know about.

  • \$\begingroup\$ @ jonk Thanks for that. I like the "floor on a pole" method. \$\endgroup\$ Apr 24, 2017 at 3:41
  • \$\begingroup\$ @analogsystemsrf Thanks for the kind word. For good or bad, I don't learn "by rote." I fail when trying to memorize formulas. Instead, I must develop a mental gestalt (a geometry of sorts) that "sings to me." It's that picture I remember. From that, I can create the quantitative formulas on the fly using the picture to guide development. From Newton's "all particles attract all other particles" I can immediately deduce \$F=G\frac{m_1 \cdot m_2}{r^2}\$ from simple argument, without memorization. I can't forget it, because I never memorized it. I remember the insight, instead. \$\endgroup\$
    – jonk
    Apr 24, 2017 at 4:00
  • \$\begingroup\$ @jonk You said: "There is no right way. It's arbitrary". Let's say I want to calculate the voltage between \$V_2\$ and the negative pin of \$V99\$. If I choose the current direction of \$R_4\$ to be left-right (positive pin on \$V_2\$ side) and the current of \$V99\$ as top-down then the two components have the same current direction so the resulting voltage is the sum of the two voltages. However the resistor \$R_4\$ is a passive component while the voltage source \$V99\$ is an active component and whatever convention is used the power signs must differ. How can this be possible ? \$\endgroup\$
    – Bemipefe
    Dec 17, 2019 at 20:42
  • \$\begingroup\$ @Bemipefe The context is a current, which has an arrow. You can choose to make that arrow point any direction you want. You can choose to make the current direction in a voltage source be the exact opposite of what you are sure it will be, if you want to. Current directions are simply a convention. And you can choose that convention. The only requirement is that you set up your equations in such a way that they conform to the assumptions you make and that when you get results from those equations, that you interpret the signs, correctly. \$\endgroup\$
    – jonk
    Dec 17, 2019 at 21:17
  • \$\begingroup\$ @Bemipefe Nature does not care about any of this. It does what it does. We humans choose to think with ideas that "sing in our mind" (are easier for us, than other ways.) For some, the melody of a mesh network is what sings better. For others, the melody of nodal analysis sings better. Use what sings in your mind. Concepts in our heads are different than concepts in the heads of others. But both can solve the same problems using these different tools. Current direction is like that. Use whatever works better for you. But still remain logically consistent in the application. Logic rules remain. \$\endgroup\$
    – jonk
    Dec 17, 2019 at 21:19

When you are placing those current arrows on your branches, you are not choosing the direction of the current, you are choosing a reference direction.

You are going to use this reference direction twice, and you must use it consistently, the same way each time.

The first time you use it will be when you set up your nodal equations, to get the signs of the various terms consistent.

The next time you use it will be to interpret the sign of the branch current you calculated.

For any given circuit, the current will flow only one way in any given branch. If you invert the reference arrow, you'll find that the branch current comes out with the other sign.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.