Hello everyone. In this video, we review Kirchhoff's circuit laws, namely KCL and KVL. We also review how to convert a KCL equation and represent it in terms of node voltage. Same for KVL, we represented it in terms of mesh current. This leads us to node voltage analysis and mesh current analysis. Both are simple yet effective techniques to solve for circuit parameters. We start with the current law, KCL. The Kirchhoff current law states that the summation of all current entering a node must equal zero. Or, in other words, the summation of current entering the node should equal the summation of the current leaving that node. And this comes from the principle of charge preservation. No charge is being stuck or stored into a node. So, a node is just a pathway for the charge to go and split if we have more than one branch. In general, with a circuit that has n nodes, we can write n minus one independent node equations. So, let's practice that on this given circuit here. Here, I have a circuit with four resistors. Each resistor has an associated current I1 through I4. And you can easily identify that we have three nodes: Node A, Node B, and down here we have Node C. So, with three nodes, we can write two independent KCL equations. So, we only need to write KCL at two different nodes. Let's pick Node A and Node B. So, I'm going to write a KCL at Node A, and we'll do the same for Node B. So, these would be the two independent equations that I can get from this circuit. If you look at Node A, we have current I1 entering that node. Nothing else is entering. So, I'm ready to write an equation. And then, I have I2 leaving. So, this would be the first Kirchhoff equation that we can obtain using Node A. Now, we’re ready to move to Node B. If you look at Node B, I have I2 entering, I4 is also entering, but I3 is leaving. So, the law states that the summation of current in should equal the summation of current out. So, I have I2 and I4 going in, and I have I3 going out. Now, if you look at the circuit, we have four current unknowns, yet we only have two equations. Therefore, we need to come up with either two more equations or find a smarter way to solve for those four unknowns using these two equations. Okay, one can suggest, "How about if we use Ohm's law?" So, if I use Ohm's law, I can represent each current of these as a voltage over a resistor. So, I1 would be the voltage V_sub_1 divided by resistor R1. This is using Ohm's law. Same for I2: I2 is the current going through R2, so I can write it as V2 over R2. I can do the same with the second KCL at B. I have I2—I can replace I2 as V2 over R2—plus I4. I4 can be written as V4 over R4, and finally, I3 is equal to V3 over R3. However, after using Ohm's law here, I replaced the current but still have four unknown voltages. I cannot solve for those four unknowns using only two equations. So, the node voltage analysis came up with a nice trick. It said, "Okay, instead of using the actual voltage, how about we use the node voltage?" So, for any device that we have here—assume this device here across which I have a voltage V1—this V1 is connected between two nodes. So, how about I define a node voltage where, when we define a node voltage, it would be taken relative to some reference point we call it ground, where the voltage at the ground is 0 volt? As a result, if I have an actual element whose actual voltage here is V_sub_1, I can write V1 as the difference between the two node voltages connecting this element to the rest of the circuit. So, for this element down here, I have the first terminal or the first node is VA minus VB. So, I replace the actual voltage as a superposition or a difference between the potential or the voltage at the two nodes connected to this element. Okay, so now let's apply this voltage analysis technique to our circuit. Okay, so now I have V_sub_1. This V1 on this element R1—I can write down that V1 is... Okay, so I have two nodes here that are connected to R1 across which we have V_sub_1. So, the plus sign is relative to this node C. So, V_sub_1 can be written as the difference between two node voltages. The first node is C, VC, minus the node corresponding to the negative terminal, which is A, VA. Okay, we can do the same for V2. So, V2 has two nodes—it’s between Node A and Node B. The plus is associated with A, the minus is associated with B, so V2 is equal to VA minus VB. If you look at V3, R3 is between two nodes: Node B and Node C. So, V3 can be written as VB minus VC. And finally, V4 is connected between the same two nodes, B and C, but now the plus is associated with Node C, so it's VC minus the minus, which is associated with Node B, so it's VB. Okay, now those three node voltages are relative to one reference point. So, now we have to manually pick a reference. It could be any node as a reference. Okay, so for simplicity, let's assign Node C to be the reference. And if we did so, I now announce that VC is equal to 0 volt. Okay, so all voltages will be measured with respect to Node C. Okay, so now I can update my expression for V1. It will be 0 minus VA, which equals -VA. The expression for V2 stays the same—it's VA minus VB. For V3, it is VB minus 0, which gives me VB. And for V4, it is equal to 0—oops—minus VB, which equals -VB. Now, what is nice about that is that even though I have four different voltages, I could represent them using only two parameters: VA and VB. Okay, so if I take this representation and use it into what we have currently for the KCL equation—so for V_sub_1, I have equal to -VA / R1 equals V2. V2 is equal to VA minus VB over R2. Okay, let me do the same for the KCL at Node B. I write it in terms of V2, V3, V4. Let me replace V2, V3, and V4 in terms of the node voltages. So, V_sub_2 is equal to VA minus VB plus V4 / R4. V4 is equal to -VB, and finally, V3 over R3—I can represent V3 as VB according to our analysis on the right here. Now, I have two equations: Equation One and Equation Two—still two KCL equations, but now these two KCLs are represented in terms of node voltages. What is nice now is that I have two equations associated with two unknowns: VA and VB. So, now I can solve Equation One and Equation Two simultaneously, and this is called node voltage analysis. Once I have a solution for VA and VB, I can immediately go and solve for V1, V2, V3, and V4, and also can solve for the corresponding currents I1 through I4. So, this is formally known as the node voltage analysis technique. The second Kirchhoff circuit law that we have is the voltage law, KVL. The KVL is about the voltage within each loop. The law states that the voltage drop across all elements in a loop must add up to zero. If I have a circuit with n loops, I can write n independent loop equations. So, let's apply that to this example here. If you look here, I have two loops. This is Loop Number One, and this is Loop Number Two. I can write KVL in each loop, and this would give me two independent equations. So, let me write a KVL in Loop One. When I go over the elements in Loop One clockwise, I start from the far left. I have +V1, +V2, and then +V3, and this completes the loop. The summation of V_sub_1 plus V_sub_2 plus V3 equals zero. And this is the KVL equation for Loop Number One. I can do the same for Loop Two. So, KVL in Loop Two. In Loop Two, I have only two elements. So, if I go from the far left corner, I start from here. I have -V3 and then -V4, and this completes the loop. So, I have -V3 minus V4 equals zero. Now, I have two equations. But how many unknowns do I have? Four unknown voltages. So, it is the same issue as the KCL—the number of unknowns is larger than the number of equations. So, we either need more equations or come up with a more innovative way. Okay, so one suggestion is, "Let's use Ohm's law." I can represent the voltage as a current times the resistor. So, V_sub_1 is equal to R1 * I1, V2 is equal to R2 * I2, and V3 is equal to R3 * I3. I just use Ohm's law to represent the voltage as resistance times the corresponding current. I can do the same for the bottom equation. First of all, I can multiply this equation by -1, so I get V3 plus V4 equal to 0. V3 is equal to R3 * I3, and V4 is equal to R4 * I4. So, now I converted the voltage into a current times resistor. But we still have the same issue: I have two equations, but how many unknowns? Still four—I1 through I4. So, here, the mesh current technique kicks in. We introduce a mesh current where we define a current for each loop that we have. So, let's here define a current IX for this first loop and a current IY for the second loop. Then, the actual current in element number K would be a superposition between these two loop currents. Okay, if an element is shared between two loops—like element R3 here—I can write that I3 is equal to the superposition between IX and IY. So, should it be IX minus IY or should it be IY minus IX? This actually depends on the directionality. If you note here, you can see IX is pointing down when it visits R3, so it matches the same direction as I3. So, IX takes a positive sign. When you look at IY, it is actually pointing up when it visits R3, and this mismatches the direction for I3. That's why we have a negative sign here. Okay, now all other elements live in only one loop. There is no shared loop for R1 or R2 or R4. So, R1 here only lives in Loop One. So, the actual current I1 would be equal to the loop current IX—plus or minus depending on the directionality. Now, when you look at IX—when IX is visiting R1, it points up in the same direction as I1. So, I1 is equal to +IX. Okay, same when IX here is visiting or traversing R2—it follows the same direction as I2. So, I2 is equal to IX. Note here in R1 and R2, the only loop current components that loop through them is IX, and as a result, I have only IX here. Whereas R3 is shared between two loops, so it has IX looping from left and IY looping from right. That's why we have I3 written as a superposition between IX and IY. Okay, the final current that we didn't cover yet is I4. I4 is the current through R4. Now, when you look at the loop current looping resistor R4, it's only IY. So, when IY is going into R4, it's going from top to bottom, whereas I4 is going bottom-up. So, there is a mismatch in directionality. To correct for this mismatch, we have a negative sign, so it's -IY. So, now what I did is I represented the four different currents I have in terms of only two mesh currents. And now, if you go back to our KVL equations, if I replace each of those currents in terms of the corresponding loop currents, I'm going to have simplified equations in terms of only two unknowns, which are the loop currents. Okay, let me put this together. So, I'm going to use this equation that has a resistor times the current. I have R1 * I1 is equal to IX, and then plus R2 * I2—from the previous slide, is equal to IX—plus R3 * I3. Now, I3 is a shared element between the two loops, so I3 will equal the superposition between IX and IY. IX matches the same direction as I3, so it takes a positive sign. IY mismatches the direction of I3, so it takes a negative sign. And this completes this equation. Now, a bit of algebra: Combine what belongs to IX together and what belongs to IY together. So, I have (R1 + R2 + R3) * IX - R3 * IY equals zero. Let me call this Equation Number One and stop here. Now, let me move to the KVL in the second loop. So, this is the KVL that I have in the second loop. Right now, I have it represented in terms of I3 and I4. So, how about I replace I3 and I4 and represent them in terms of the loop current? So, the equation I have is I3—I3 now is equal to IX minus IY as we described in the previous slide—and finally, the last term is R4 * I4, and I4 is equal to -IY. Okay, and the right-hand side is equal to zero. Again, use algebra to simplify this equation. Whatever belongs to IX is here. Okay, and then I have -R3 * IX + (R3 + R4) * IY equals zero. And let me call this Equation Two. Still, I have two equations because I still only wrote two KVLs. But now, what is nice about these two equations is that they are a function of only two unknowns: IX and IY. So, once I solve for IX and IY using simultaneous solution of these two equations, I can solve for the corresponding I1, I2, I3, I4. And once I have I1, I2, I3, I4, I can solve for V1 through V4. So, basically, I have the voltage and the current everywhere once I have a solution for IX and IY. So, this approach here is called mesh current analysis, where I start by writing a regular KVL and then replace the actual current via a loop current and then simultaneously solve for those loop currents. And once I have the loop currents, I can get all actual currents and, as a result, can also get all actual voltages. So, in conclusion, in this video, we reviewed two basic circuit laws: KCL and KVL. But KCL and KVL alone are not sufficient because I may have the number of equations less than the number of unknowns. And here comes the trick in the node voltage analysis and the mesh current analysis. The trick is, if you write a KCL, you replace the current as a voltage over a resistor, and then this actual voltage of an element can be represented as a difference between the voltage of the two nodes connected to that element. On the other hand, if you're using KVL, you write down the summation of voltage equal to zero. Then, you replace this voltage as a resistance times a current. But this is an actual current. The trick here in mesh current analysis is that you replace the actual current and rewrite it in terms of the mesh current, which now would reduce the number of unknowns and help us to use this smaller number of equations to solve for either the node voltage or the mesh current. And from there, once you have either the node voltage or the mesh current, you can solve for the actual voltage and current in all circuit elements. Thank you so much!