Wolfram Alpha:

```Kirchoff's Laws
---------------
Following the conventional current flow that electric charge moves from the
positive side of the battery to the negative side, the rule for voltage
sources is as follows:

.  - to + causes an increase in potential.
.  + to - causes a decrease in potential.

For resistors (impedances) the rules are as follows:

.  Subtract voltage drop in the direction of the current flow.
.  Increase voltage in the direction against the current flow.

Consider:

Current Law:

ΣIk = 0 => I3 = I1 + I2
k

In this case, the direction of the current flows is chosen in accordance
with the conventional current flow, and is consistent for each loop. Thus,
the direction of I1 and I2 set to be away from the + terminals.

Use B as common node (ground if you like), thus VB = 0

Starting at B and proceeding clockwise around loop BEFAB:

-I3R3 - I1R1 + V1 = 0
V1 = I3R3 + I1R1

Starting at B and proceeding clockwise around loop BCDEB:

-V2 + I2R2 + I3R3 = 0
V2 = I2R2 + I3R3

What happens if we start at B and, instead, proceed counter clockwise
around BEDCB:

-I3R3 - I2R2 + V2 = 0
V2 = I3R3 + I2R2 ... the same as the clockwise result

We could also use loops BEFAB or BCDEB and BCDEFAB for the analysis.
Again, we would get the same result. For the loop BCDEFAB we would get,

-V2 + I2R2 - I1R1 + V1 = 0

V1 - V2 = I1R1 - I2R2

As long as the rules and current conventions are followed, Kirchoff's
laws work regardless of the chosen loop and direction.  The actual net
current directions are reflected in the sign of the answer.

Ex. 1

Find currents through each battery with switch closed and switch open.

Switch closed:

I3 = I2 - I1 (direction of I1 and I3 set to be away from + terminals)

Starting at B and proceeding clockwise around loop BEFAB:

-9 + 4I3 - 2I1 + 6 = 0
3 = 4I3 - 2I1
3 = 4I2 - 6I1 .... (1)

Starting at B and proceeding clockwise around loop BCDEB:

-5I2 - 4I3 + 9 = 0
9 = 5I2 - 4I3
9 = 9I2 - 4I1 .... (2)

From (1) and (2),

12 = 16I2 - 24I1
54 = 54I2 - 24I1
-42 = - 38I2
I2 = 1.105 A

From (1),

3 = 4 * 1.105 - 6I1
I1 = (3 - 4.421)/-6 = 0.24 A

and

I3 = I2 - I1 = 1.105 - 0.24 = 0.865 A

Switch open:

I2 = 0 so I3 = -I1

-9 + 4I3 - 2I1 + 6 = 0
-3 = 4I1 + 2I1
I1 = -3/6 = 0.5 A

Ex 2.

I3 = I1 + I2 (direction of I1 and I2 set to be away from + terminals)

Starting at B and proceeding clockwise around loop BEFAB:

-40I3 + 10 - 10I1 = 0
10 = 10I1 + 40I3
10 = 10I1 + 40I1 + 40I2
10 = 50I1 + 40I2
1 = 5I1 + 4I2 .... (1)

Starting at B and proceeding clockwise around loop BCDEB:

20I2 - 20 + 40I3 = 0
20 = 20I2 + 40I3
20 = 20I2 + 40I1 + 40I2
20 = 60I2 + 40I1
1 = 2I1 + 3I2 ....(2)

From (1) and (2),

6 = 30I1 + 24I2
8 = 16I1 + 24I2
-2 = 14I1
I1 = -0.143 A

From (1),

1 = 5I1 + 4I2 .... (1)
1 + 0.714 = 4I1
I2 = 0.429 A

and

I3 = I1 + I2 = -0.143 + 0.429 = 0.286 A

```