\section{Circuits}

An \textit{electrical circuit} is a graph with a few extra properties,
called \textit{current}, \textit{voltage}, and \textit{resistance}.

\begin{itemize}[itemsep=3mm]
	\item \textbf{Voltage} is a function $V(n): N \to \mathbb{R}$ that assigns a number to each node of our graph. \par
	In any circuit, we pick a \say{ground} node, and define the voltage\footnotemark{} there as 0. \par
	We also select a \say{source} node, and define its voltage as 1. \par

	\vspace{1mm}

	Intuitively, you could say we're connecting the ends of a 1-volt battery to our source and ground nodes.

	\footnotetext{
		In the real world, voltage is always measured \textit{between two points} on a circuit.
		Voltage is defined as the \textit{difference} in electrical charge between two points.
		Here, all voltages are measured with respect to our \say{ground} node.
	
		This detail isn't directly relevant to the problems in this handout, so you mustn't worry about it today. \par
		Just remember that the electrical definitions here are a significant oversimplification of reality.
	}


	\item \textbf{Current} is a function $I(e^\rightarrow): N \times N \to \mathbb{R}$ that assigns a number to each
	\textit{oriented edge} $e^\rightarrow$ in our graph. An \say{oriented edge} is just an ordered pair of nodes $(n_1, n_2)$. \par

	\vspace{1mm}

	Current through an edge $(a, b)$ is a measure of the flow of charge from $a$ to $b$. \par
	Naturally, $I(a, b) = -I(b, a)$.


	\item \textbf{Resistance} is a function $R(e): N \times N \to \mathbb{R}^+_0$ that represents a certain edge's
	resistance to the flow of current through it. \par
	Resistance is a property of each \textit{link} between nodes, so order doesn't matter: $R(a, b) = R(b, a)$.
\end{itemize}

\vspace{2mm}

It is often convenient to compare electrical circuits to systems of pipes. Say we have a pipe from point $A$ to point $B$.
The size of this pipe represents resistance (smaller pipe $\implies$ more resistance), the pressure between $A$ and $B$
is voltage, and the speed water flows through it is to current.


\definition{Ohm's law}
With this \say{pipe} analogy in mind, you may expect that voltage, current, and resistance are related:
if we make our pipe bigger (and change no other parameters), we'd expect to see more current. This is indeed
the case! Any circuit obeys \textit{Ohm's law}, stated below:
$$
	V(a, b) = I(a,b) \times R(a,b)
$$
\note{
	$V(a, b)$ is the voltage between nodes $a$ and $b$. If this doesn't make sense, read the footnote below. \\
	In this handout, it will be convenient to write $V(a, b)$ as $V(a) - V(b)$.
}


\definition{Kirchoff's law}
The second axiom of electrical circuits is also fairly simple. \textit{Kirchoff's law} states that the sum of all currents connected to
a given edge is zero. You can think of this as \say{conservation of mass}: nodes in our circuit do not create or 
destroy electrons, they simply pass them around to other nodes.\par
Formally, we can state this as follows:

\vspace{2mm}

Let $x$ be a node in our circuit and $B_x$ the set of its neighbors. We than have
$$
	\sum_{b \in B_x} I(x, b) = 0
$$
which must hold at every node \textbf{except the source and ground vertices.} \par
\hint{Keep this exception in mind, it is used in a few problems later on.}


\vfill
\pagebreak








Consider the circuit below. This the graph from \ref{firstgraph}, turned into a circuit by:
\begin{itemize}
	\item Replacing all edges with $1\Omega$ resistors
	\item Attaching a 1 volt battery between $A$ and $B$
\end{itemize}
\vspace{2mm}
Note that the battery between $A$ and $B$ isn't really an edge.
It exists only to create a potential difference between the two nodes.

\begin{center}
\begin{circuitikz}[american voltages]
	\draw
		(0,0) node[above left] {$A$ (source)}
		to[R, l=$1\Omega$, *-*] (2,0) node[above] {$x$}
		to[R, l=$1\Omega$, *-*] (4,0) node[above] {$y$}
		to[R, l=$1\Omega$, *-*] (6,0) node[above right] {$B$ (ground)}
		to[short] (6, -1) node[below] {$-$}
		to[battery,invert,l={1 Volt}] (0, -1) node[below] {$+$}
		to[short] (0, 0)
	;
\end{circuitikz}
\end{center}

\problem{}<onecurrents>
From the circuit diagram above, we immediatly know that $V(A) = 1$ and $V(B) = 0$. \par
What equations related to the currents out of $x$ and $y$ does Kirchoff's law give us?

\vfill




\problem{}
Use Ohm's law to turn the equations from \ref{onecurrents} into equations about voltage and resistance. \par
Find an expression for $V(x)$ and $V(y)$ in terms of other voltages, then solve the resulting system of equations.
Does your result look familiar?

\begin{solution}
	\setlength{\abovedisplayskip}{0pt} % Fix spacing on top
	\begin{flalign*}
		V(x) &= \frac{V(A) - V(y)}{2} &&\\
		V(y) &= \frac{V(x) - V(B)}{2} &&
	\end{flalign*}
\end{solution}

\vfill
\pagebreak
