Sunday, May 22, 2011

Linear algebra and electricity of a car

The diagram below shows some of a car's electrical network. The battery is on the left, drawn as stacked line segments. The wires are drawn as lines, shown straight and with sharp right angles for neatness. Each light is a circle enclosing a loop.



The designer of such a network needs to answer questions like: How much electricity flows when both the hi-beam headlights and the brake lights are on? Below, we will use linear systems to analyze simpler versions of electrical networks.

For the analysis we need two facts about electricity and two facts about electrical networks.

The first fact about electricity is that a battery is like a pump: it provides a force impelling the electricity to flow through the circuits connecting the battery's ends, if there are any such circuits. We say that the battery provides a potential to flow. Of course, this network accomplishes its function when, as the electricity flows through a circuit, it goes through a light. For instance, when the driver steps on the brake then the switch makes contact and a circuit is formed on the left side of the diagram, and the electrical current flowing through that circuit will make the brake lights go on, warning drivers behind.

The second electrical fact is that in some kinds of network components the amount of flow is proportional to the force provided by the battery. That is, for each such component there is a number, it's resistance, such that the potential is equal to the flow times the resistance. The units of measurement are: potential is described in volts, the rate of flow is in amperes, and resistance to the flow is in ohms. These units are defined so that .

Components with this property, that the voltage-amperage response curve is a line through the origin, are called resistors. (Light bulbs such as the ones shown above are not this kind of component, because their ohmage changes as they heat up.) For example, if a resistor measures 2 ohms then wiring it to a 12 volt battery results in a flow of 6 amperes. Conversely, if we have flow of electrical current of 2 amperes through it then there must be a 4 volt potential difference between it's ends. This is the voltage drop across the resistor. One way to think of a electrical circuits like the one above is that the battery provides a voltage rise while the other components are voltage drops.

The two facts that we need about networks are Kirchhoff's Laws.

Current Law. For any point in a network, the flow in equals the flow out.
Voltage Law. Around any circuit the total drop equals the total rise.
In the above network there is only one voltage rise, at the battery, but some networks have more than one.

For a start we can consider the network below. It has a battery that provides the potential to flow and three resistors (resistors are drawn as zig-zags). When components are wired one after another, as here, they are said to be in series.



By Kirchhoff's Voltage Law, because the voltage rise is 20 volts, the total voltage drop must also be 20 volts. Since the resistance from start to finish is 10 ohms (the resistance of the wires is negligible), we get that the current is (20 / 10) = 2 amperes. Now, by Kirchhoff's Current Law, there are 2 amperes through each resistor. (And therefore the voltage drops are: 4 volts across the 2 oh m resistor, 10 volts across the 5 ohm resistor, and 6 volts across the 3 ohm resistor.)

The prior network is so simple that we didn't use a linear system, but the next network is more complicated. In this one, the resistors are in parallel. This network is more like the car lighting diagram shown earlier.



We begin by labeling the branches, shown below. Let the current through the left branch of the parallel portion be i1 and that through the right branch be i2, and also let the current through the battery be i0. (We are following Kirchoff's Current Law; for instance, all points in the right branch have the same current, which we call i2. Note that we don't need to know the actual direction of flow— if current flows in the direction opposite to our arrow then we will simply get a negative number in the solution.)



The Current Law, applied to the point in the upper right where the flow i0 meets i1 and i2, gives that i0 = i1 + i2. Applied to the lower right it gives i1 + i2 = i0. In the circuit that loops out of the top of the battery, down the left branch of the parallel portion, and back into the bottom of the battery, the voltage rise is 20 while the voltage drop is , so the Voltage Law gives that 12i1 = 20. Similarly, the circuit from the battery to the right branch and back to the battery gives that 8i2 = 20. And, in the circuit that simply loops around in the left and right branches of the parallel portion (arbitrarily taken clockwise), there is a voltage rise of 0 and a voltage drop of 8i2 − 12i1 so the Voltage Law gives that 8i2 − 12i1 = 0.


The solution is i0 = 25 / 6, i1 = 5 / 3, and i2 = 5 / 2, all in amperes. (Incidentally, this illustrates that redundant equations do indeed arise in practice.)

Kirchhoff's laws can be used to establish the electrical properties of networks of great complexity. The next diagram shows five resistors, wired in a series-parallel way.



This network is a Wheatstone bridge (see Problem 4). To analyze it, we can place the arrows in this way.



Kirchoff's Current Law, applied to the top node, the left node, the right node, and the bottom node gives these.


Kirchhoff's Voltage Law, applied to the inside loop (the i0 to i1 to i3 to i0 loop), the outside loop, and the upper loop not involving the battery, gives these.


Those suffice to determine the solution i0 = 7 / 3, i1 = 2 / 3, i2 = 5 / 3, i3 = 2 / 3, i4 = 5 / 3, and i5 = 0.

THE $25,000,000,000 EIGENVECTOR THE LINEAR ALGEBRA BEHIND GOOGLE



Google’s success derives in large part from its PageRank algorithm, which ranks the importance of webpages according to an eigenvector of a weighted link matrix. Analysis of the PageRank formula provides a wonderful applied topic for a linear algebra course.


PageRank algorithm, which quantitatively rates the importance of each page on the web.

Google calculates web page rankings using standard linear algebra application. It does three basic things:

1. Crawl the web and locate all web pages with public access.

2. Index the data from step 1, so that it can be searched efficiently for relevant keywords or phrases.

3. Rate the importance of each page the subset of pages in the database been found, the most important pages can be presented first.

The importance score for any web page will always be a non-negative real number.

An arrow from page A to page B indicates alink from page A to page B.

xk denotes the importance score of page k in the web

x1 = 2, x2 = 1, x3 = 3, and x4 = 2, so that page 3 would be the most important,

pages 1 and 4 tie for second, and page 2 is least important. A link to page k becomes a vote for

page k’s importance.

This approach ignores an important feature ranking algorithm that a link to page k from an important page should boost page k’s importance score more than a link from an unimportant page.


we will boost page k’s score by xj/nj , rather than by xj .

xk = ∑ xj/ nk

j ϵ Lk ( a link from a page to itself will not be counted.)
Let’s apply this approach :

x1 = x3/1 +

x4/2, since pages 3 and 4 are backlinks for page 1 and page 3 contains only one link, while page 4 contains two links (splitting its vote in half). Similarly, x2 = x1/3, x3 = x1/3 + x2/2 + x4/2, andx4 = x1/3 + x2/2. These linear equations can be written Ax = x, where x = [x1 x2 x3 x4]T

This transforms the web ranking problem into the “standard” problem of finding an eigenvector for a square matrix! (Recall : eigenvalues _ and eigenvectors x of a matrix A satisfy the equation Ax = λx, x != 0 by definition.)

x1 ~=0.387, x2~ = 0.129,x3 ~= 0.290, and x4 ~=.194.

Note that this ranking differs from that generated by simply

counting backlinks. It might seem surprising that page 3, linked to by all other pages, is not the most important. To understand this, note that page 3 links only to page 1 and so casts its entire vote for page 1. This, with the vote of page 2, results in page 1 getting the highest importance score.


[THE $25,000,000,000 EIGENVECTOR THE LINEAR ALGEBRA BEHIND GOOGLE
KURT BRYAN† AND TANYA LEISE
[ SIAM Review Volume 48 Issue 3, 2006
Society for Industrial and Applied Mathematics Philadelphia, PA, USA]]