Prove/n androidComing Soon
menu_book Review / The material behind the questions

Brush up before you prove it.

Every Prove/n question comes from the topics below. Each section gives the key definitions, formulas and theorems, a worked example, and free textbooks to go deeper. It's a refresher, not a course.

functionsMath

From arithmetic to university topics. Questions are answered in your head, so the examples use small numbers.

Arithmetic1 Level 1

Rules

  • Order of operations: brackets first, then multiplication and division (left to right), then addition and subtraction (left to right). So \(6+2\times3=12\), not 24.
  • Division with a remainder: \(23\div4\) is 5 remainder 3, because \(4\times5=20\) and \(23-20=3\). The remainder is always smaller than the number you divide by.
  • Making change: change = amount paid − total cost. Add up everything bought first.
  • Rounding to the nearest ten: look at the ones digit. 5 or more rounds up (67 becomes 70), less rounds down (63 becomes 60).
Divisiondividend = divisor × quotient + remainder
Common anglesright angle 90°, straight line 180°, three quarter turns 270°, full turn 360°

Pens cost $3 and notebooks $4. Sam buys 7 pens and 2 notebooks and pays with $50. How much change?

  1. Pens: \(7\times3=21\). Notebooks: \(2\times4=8\).
  2. Total: \(21+8=29\).
  3. Change: \(50-29\).

$21

A clock's minute hand turns clockwise from 12 to 9. How many degrees is that?

  1. Each quarter of the clock face is 90°.
  2. 12 to 9 is three quarters: \(3\times90\).

270°

Algebra1 Levels 2–3

Fractions, decimals and percentages

  • Fractions: to add or subtract, rewrite over a common denominator. To divide, multiply by the reciprocal.
  • Percent means "per hundred": \(p\%\) of \(x\) is \(\tfrac{p}{100}\cdot x\).
Adding fractions\(\dfrac{a}{b}+\dfrac{c}{d}=\dfrac{ad+bc}{bd}\)
Percent change\(\dfrac{\text{new}-\text{old}}{\text{old}}\times 100\%\)

What is \(\tfrac{3}{4}+\tfrac{1}{6}\)?

  1. Common denominator 12: \(\tfrac{9}{12}+\tfrac{2}{12}\).
  2. Add the numerators.

\(\tfrac{11}{12}\)

Linear equations and inequalities

  • Solve by doing the same inverse operation to both sides until \(x\) is alone.
  • Multiplying or dividing an inequality by a negative number flips its direction.
  • A line is \(y=mx+b\): slope \(m\), y-intercept \(b\).
Slope through two points\(m=\dfrac{y_2-y_1}{x_2-x_1}\)
Exponent rules\(a^m a^n=a^{m+n},\ (a^m)^n=a^{mn},\ a^{-n}=\tfrac{1}{a^n},\ a^0=1\)

Quadratics

  • Factoring \(x^2+bx+c\): find \(p,q\) with \(p+q=b\) and \(pq=c\), then \(x^2+bx+c=(x+p)(x+q)\).
  • Difference of squares: \(a^2-b^2=(a-b)(a+b)\).
  • Zero-product rule: if \(AB=0\) then \(A=0\) or \(B=0\). So \((x-5)(x-2)=0\) gives \(x=5\) or \(x=2\).
  • The graph of \(y=ax^2+bx+c\) is a parabola: it opens up if \(a>0\), down if \(a<0\), with its vertex at \(x=-\tfrac{b}{2a}\).
Quadratic formula\(x=\dfrac{-b\pm\sqrt{b^2-4ac}}{2a}\)
Discriminant \(\Delta=b^2-4ac\)\(\Delta>0\): two real roots, \(\Delta=0\): one, \(\Delta<0\): none

Logarithms

Definition\(\log_b x=y \iff b^y=x\)
Rules\(\log_b(xy)=\log_b x+\log_b y,\ \log_b x^k=k\log_b x\)

Solve \(x^2-5x+6=0\).

  1. Find two numbers with sum \(-5\) and product \(6\): \(-2\) and \(-3\).
  2. \((x-2)(x-3)=0\).
  3. Zero-product rule.

\(x=2\) or \(x=3\)

What is \(\log_2 32\)?

  1. Ask: 2 to what power is 32? \(2^5=32\).

5

Precalculus1 Level 4

Functions and trigonometry

  • Composition: \((f\circ g)(x)=f(g(x))\). Apply \(g\) first.
  • Radians: \(\pi\text{ rad}=180^\circ\).
  • Unit circle: \(\sin\tfrac{\pi}{6}=\tfrac12\), \(\cos\tfrac{\pi}{3}=\tfrac12\), \(\sin\tfrac{\pi}{4}=\cos\tfrac{\pi}{4}=\tfrac{\sqrt2}{2}\), \(\sin 0=0\), \(\cos 0=1\).
Pythagorean identity\(\sin^2\theta+\cos^2\theta=1\)
Tangent\(\tan\theta=\dfrac{\sin\theta}{\cos\theta}\)

Complex numbers

  • \(i^2=-1\). Powers of \(i\) repeat every four: \(i,\,-1,\,-i,\,1\).
  • The conjugate of \(a+bi\) is \(a-bi\), and \((a+bi)(a-bi)=a^2+b^2\).
Multiplication\((a+bi)(c+di)=(ac-bd)+(ad+bc)i\)
Modulus\(|a+bi|=\sqrt{a^2+b^2}\)
Polar form and De Moivre\(\big(r(\cos\theta+i\sin\theta)\big)^n=r^n(\cos n\theta+i\sin n\theta)\)

What is \((2+3i)(1-i)\)?

  1. Expand: \(2-2i+3i-3i^2\).
  2. \(i^2=-1\), so \(-3i^2=3\).
  3. Collect: \(5+i\).

\(5+i\)

Solve \(2^{x+1}=16\).

  1. \(16=2^4\), so \(x+1=4\).

\(x=3\)

Calculus 12 Level 5

Limits and continuity

Limit:
\(\lim_{x\to a}f(x)=L\) means \(f(x)\) gets arbitrarily close to \(L\) as \(x\) approaches \(a\). It exists only if both one-sided limits exist and are equal.
Continuous at \(a\):
\(f(a)\) is defined and \(\lim_{x\to a}f(x)=f(a)\).

Derivatives

Definition\(f'(x)=\lim_{h\to0}\dfrac{f(x+h)-f(x)}{h}\)
Power rule\(\dfrac{d}{dx}x^n=nx^{n-1}\)
Product rule\((fg)'=f'g+fg'\)
Quotient rule\(\left(\dfrac{f}{g}\right)'=\dfrac{f'g-fg'}{g^2}\)
Chain rule\(\dfrac{d}{dx}f(g(x))=f'(g(x))\,g'(x)\)
Common derivatives\((\sin x)'=\cos x,\ (\cos x)'=-\sin x,\ (e^x)'=e^x,\ (\ln x)'=\tfrac1x\)

Theorems

L'Hôpital's rule. If \(\tfrac{f(x)}{g(x)}\) gives \(\tfrac00\) or \(\tfrac{\infty}{\infty}\) at \(a\), then \(\lim_{x\to a}\tfrac{f(x)}{g(x)}=\lim_{x\to a}\tfrac{f'(x)}{g'(x)}\), if the second limit exists.
Mean Value Theorem. If \(f\) is continuous on \([a,b]\) and differentiable on \((a,b)\), some \(c\) in \((a,b)\) has \(f'(c)=\tfrac{f(b)-f(a)}{b-a}\).
Extrema. Local maxima and minima of a differentiable function occur where \(f'(x)=0\). If \(f''(x)>0\) there it's a minimum, if \(f''(x)<0\) a maximum.

Find \(\lim_{x\to1}\dfrac{x^2-1}{x-1}\).

  1. Factor: \(\tfrac{(x-1)(x+1)}{x-1}=x+1\) for \(x\ne1\).
  2. Substitute \(x=1\).

2

Differentiate \((3x^2+1)^5\).

  1. Chain rule: outer \(u^5\) gives \(5u^4\), inner \(3x^2+1\) gives \(6x\).
  2. Multiply.

\(30x(3x^2+1)^4\)

Calculus 22 Level 6

Integrals

Fundamental Theorem of Calculus. If \(F'=f\), then \(\int_a^b f(x)\,dx=F(b)-F(a)\). Also, \(\tfrac{d}{dx}\int_a^x f(t)\,dt=f(x)\).
Power rule\(\int x^n\,dx=\dfrac{x^{n+1}}{n+1}+C,\ n\ne-1\)
Integration by parts\(\int u\,dv=uv-\int v\,du\)
Substitution\(\int f(g(x))g'(x)\,dx=\int f(u)\,du\)
Improper integral\(\int_a^\infty f\,dx=\lim_{t\to\infty}\int_a^t f\,dx\)

Sequences and series

Geometric series, \(|r|<1\)\(\sum_{n=0}^{\infty}ar^n=\dfrac{a}{1-r}\)
p-series\(\sum \tfrac{1}{n^p}\) converges if and only if \(p>1\)
Taylor series at \(a\)\(f(x)=\sum_{n=0}^{\infty}\dfrac{f^{(n)}(a)}{n!}(x-a)^n\)
Maclaurin series\(e^x=\sum \tfrac{x^n}{n!},\ \sin x=x-\tfrac{x^3}{3!}+\tfrac{x^5}{5!}-\cdots\)

Find \(\int_0^3 2x\,dx\).

  1. An antiderivative of \(2x\) is \(x^2\).
  2. \(3^2-0^2\).

9

Sum \(3+1+\tfrac13+\tfrac19+\cdots\)

  1. Geometric with \(a=3\), \(r=\tfrac13\).
  2. \(\tfrac{3}{1-1/3}=\tfrac{3}{2/3}\).

\(\tfrac92\)

Linear algebra3 Level 6

Linearly independent:
no vector in the set is a combination of the others.
Rank:
the number of linearly independent rows (equivalently, columns).
Eigenvector:
a nonzero \(v\) with \(Av=\lambda v\). The scalar \(\lambda\) is its eigenvalue.
Dot product\(u\cdot v=\sum u_iv_i=|u||v|\cos\theta\)
2×2 determinant\(\det\begin{pmatrix}a&b\\c&d\end{pmatrix}=ad-bc\)
2×2 inverse\(\dfrac{1}{ad-bc}\begin{pmatrix}d&-b\\-c&a\end{pmatrix}\)
Eigenvalues\(\det(A-\lambda I)=0\)
Rank–nullity theorem.3 For an \(m\times n\) matrix, \(\operatorname{rank}+\operatorname{nullity}=n\), the number of columns.
Trace and determinant. The eigenvalues sum to the trace and multiply to the determinant. Matrix multiplication is generally not commutative: \(AB\ne BA\).

Find the eigenvalues of \(\begin{pmatrix}4&1\\2&3\end{pmatrix}\).

  1. \(\det\begin{pmatrix}4-\lambda&1\\2&3-\lambda\end{pmatrix}=(4-\lambda)(3-\lambda)-2\).
  2. \(\lambda^2-7\lambda+10=0\), so \((\lambda-5)(\lambda-2)=0\).
  3. Check: \(5+2=7\) (trace), \(5\cdot2=10\) (determinant).

\(\lambda=5\) and \(\lambda=2\)

Advanced topics2,4,5 Level 7

Hard questions at this level are mostly conceptual: what a theorem says and what it implies.

Multivariable calculus and differential equations

Gradient\(\nabla f=\left(\tfrac{\partial f}{\partial x},\tfrac{\partial f}{\partial y},\tfrac{\partial f}{\partial z}\right)\)
Divergence\(\nabla\cdot F=\tfrac{\partial F_1}{\partial x}+\tfrac{\partial F_2}{\partial y}+\tfrac{\partial F_3}{\partial z}\)
Exponential growth\(y'=ky \Rightarrow y=Ce^{kx}\)

Abstract algebra

Group:
a set with an operation that is closed and associative, with an identity element and an inverse for every element.
Field:
a set where you can add, subtract, multiply, and divide by anything nonzero, such as \(\mathbb{Q}\), \(\mathbb{R}\), \(\mathbb{C}\).
Lagrange's theorem.4 In a finite group, the order of every subgroup divides the order of the group. A group of order 12 has no subgroup of order 5.
Galois theory links field extensions to groups4: each polynomial has a Galois group of symmetries of its roots, and the polynomial is solvable by radicals exactly when that group is solvable. That's why there is no general formula in radicals for degree 5 and up (the Abel–Ruffini theorem).

Analysis and number theory

Cauchy's integral theorem.5 If \(f\) is holomorphic (complex differentiable) on a simply connected region, its integral around any closed curve in that region is 0.
Residue theorem.5 \(\oint_\gamma f(z)\,dz=2\pi i\sum \operatorname{Res}(f,z_k)\) over the poles inside \(\gamma\). For example, \(\oint_{|z|=1}\tfrac{1}{z}\,dz=2\pi i\).
Completeness of \(\mathbb{R}\). Every Cauchy sequence of real numbers converges. That's not true in \(\mathbb{Q}\).
Fermat's little theorem. If \(p\) is prime, \(a^p\equiv a \pmod p\).

memoryComputer Science

From how a computer works to algorithms and complexity theory.

Computer basics4 Level 1

CPU:
the processor that executes program instructions.
RAM:
fast working memory for running programs. It's volatile: it loses its contents when power is off.
Storage (SSD, hard drive):
keeps files when the power is off (non-volatile), but is slower than RAM.
Operating system:
manages hardware, memory, files and running programs (Android, Windows, macOS, Linux).
Bit and byte:
a bit is a 0 or 1. A byte is 8 bits.
IP address and DNS:
every device on the internet has an IP address. DNS turns names like example.com into IP addresses.
Decimal (SI) units1 KB = 1000 B, 1 MB = 1000 KB, 1 GB = 1000 MB
Binary units41 KiB = 1024 B, 1 MiB = 1024 KiB

How many 3 MB photos fit on 1.5 GB (1 GB = 1000 MB)?

  1. 1.5 GB = 1500 MB.
  2. 1500 ÷ 3.

500

Programming basics4 Level 2

  • Binary place values are powers of 2: \(1011_2=8+0+2+1=11\).
  • Loops: in Python, range(n) gives \(0,1,\dots,n-1\), so the body runs \(n\) times.
  • Arrays are usually indexed from 0: the last of \(n\) items is at index \(n-1\).
  • Linear search checks items one by one: up to \(n\) comparisons.

What does this print?

x = 3
for i in range(4):
    x += i
print(x)
  1. i takes 0, 1, 2, 3.
  2. \(3+0+1+2+3\).

9

Data structures1,2 Levels 2–6

StructureKey ideaTypical costs
Arraycontiguous, indexedindex \(O(1)\), search \(O(n)\)
Dynamic arraydoubles when fullappend \(O(1)\) amortized
Linked listnodes with pointersinsert/delete at a known node \(O(1)\), search \(O(n)\)
Stacklast in, first out (LIFO)push, pop \(O(1)\)
Queuefirst in, first out (FIFO)enqueue, dequeue \(O(1)\)
Hash tablekey → bucket by a hashlookup \(O(1)\) average, \(O(n)\) worst
Binary heapparent ≤ children (min-heap)peek \(O(1)\), insert/extract \(O(\log n)\)
Union-finddisjoint setsnearly \(O(1)\) with path compression and union by rank
  • Load factor \(\alpha=n/m\) (keys per bucket). Collisions are handled by chaining (lists in buckets) or open addressing (probing for a free slot).
  • In a heap stored in an array from index 0, node \(i\) has children \(2i+1\) and \(2i+2\), and parent \(\lfloor (i-1)/2\rfloor\).

Push 1, 2, 3 onto an empty stack, pop once, push 4. What's on top?

  1. After the pushes, the stack is [1, 2, 3] with 3 on top.
  2. Pop removes 3. Push 4.

4

Search algorithms1,2 Levels 2–6

  • Linear search: \(O(n)\), works on any list.
  • Binary search: \(O(\log n)\), but only on sorted data. It halves the range each step, so it needs at most \(\lfloor\log_2 n\rfloor+1\) comparisons.
  • Two pointers: on sorted data, move inward from both ends, \(O(n)\).
  • BFS and DFS visit every vertex and edge of a graph: \(O(V+E)\).

Binary search for 7 in [1, 3, 5, 7, 9, 11].

  1. Middle is 5. 7 > 5, so search [7, 9, 11].
  2. Middle is 9. 7 < 9, so search [7].
  3. Found.

3 comparisons

Sorting1,2 Levels 3–6

AlgorithmBestAverageWorstStableIn place
Bubble\(O(n)\)\(O(n^2)\)\(O(n^2)\)yesyes
Selection\(O(n^2)\)\(O(n^2)\)\(O(n^2)\)noyes
Insertion\(O(n)\)\(O(n^2)\)\(O(n^2)\)yesyes
Merge\(O(n\log n)\)\(O(n\log n)\)\(O(n\log n)\)yesno
Quick\(O(n\log n)\)\(O(n\log n)\)\(O(n^2)\)noyes
Heap\(O(n\log n)\)\(O(n\log n)\)\(O(n\log n)\)noyes
  • Stable: equal keys keep their original order.
  • Quicksort hits \(O(n^2)\) with consistently bad pivots, such as always picking the last element of already sorted input.
  • Insertion sort is fast on nearly sorted data: its work is proportional to the number of out-of-order pairs (inversions).
  • Counting sort \(O(n+k)\) and radix sort \(O(d(n+k))\) don't compare elements.
Comparison sorting lower bound.1 Any comparison sort needs at least \(\lceil\log_2 n!\rceil\) comparisons in the worst case, which is \(\Omega(n\log n)\). For 4 items, that's \(\lceil\log_2 24\rceil=5\).

Trees1,2 Levels 4–6

Height:
edges on the longest path from the root to a leaf (a single node has height 0).
Binary search tree (BST):
every key in the left subtree is smaller than the node, and every key in the right subtree is larger. Search and insert take \(O(h)\).
AVL tree:
a BST where subtree heights differ by at most 1, restored by rotations, so \(h=O(\log n)\).
  • A tree with \(n\) nodes has \(n-1\) edges. A binary tree of height \(h\) has at most \(2^{h+1}-1\) nodes.
  • Preorder: root, left, right. Inorder: left, root, right (sorted order for a BST). Postorder: left, right, root. Level order: breadth-first.
  • Deleting a BST node with two children: replace it with its inorder successor (the smallest key in its right subtree).

Insert 5, 3, 8, 1, 4 into an empty BST. Give its traversals and height.

  1. 5 is the root. 3 goes left, 8 right, 1 left of 3, 4 right of 3.
  2. Inorder: 1 3 4 5 8. Preorder: 5 3 1 4 8.
  3. The longest path is 5 → 3 → 1.

Height 2

Graphs1 Levels 5–6

  • Handshake lemma: the degrees add up to \(2|E|\). A complete graph on \(n\) vertices has \(\tfrac{n(n-1)}{2}\) edges.
  • Adjacency list: \(O(V+E)\) space. Adjacency matrix: \(O(V^2)\) space, \(O(1)\) edge lookup.
  • BFS finds shortest paths by edge count. Dijkstra finds shortest paths with non-negative weights, \(O((V+E)\log V)\) with a binary heap.
  • Bellman-Ford allows negative weights and detects negative cycles, \(O(VE)\).
  • A minimum spanning tree (Kruskal, Prim) of a connected graph has \(V-1\) edges.
  • Topological sort orders a directed acyclic graph so every edge points forward. A graph is bipartite exactly when it has no odd cycle.

Edges A–B 4, A–C 1, C–B 2, B–D 5, C–D 8. Shortest distance from A to D?

  1. Settle C at 1. Through C, B is \(1+2=3\), better than 4.
  2. Through B, D is \(3+5=8\). Through C, D would be 9.

8 (A → C → B → D)

Theory of computation3 Level 7

P:
decision problems solvable in polynomial time.
NP:
decision problems whose "yes" answers can be verified in polynomial time, given a certificate. \(P\subseteq NP\).
NP-hard:
every NP problem reduces to it in polynomial time. It need not be in NP itself.
NP-complete:
both in NP and NP-hard. Examples: SAT, 3-SAT, Hamiltonian cycle, subset sum.
Decidable:
some Turing machine always halts with the right yes/no answer.
Cook–Levin theorem.3 SAT is NP-complete. A polynomial-time algorithm for any one NP-complete problem would give one for all of NP, proving \(P=NP\), which is still an open question.
The halting problem is undecidable3 (Turing, 1936). No program can decide, for every program and input, whether it eventually halts.

codeSoftware

Everyday knowledge for writing, storing and serving code, from object-oriented basics to system design.

Coding1

  • Recursion needs a base case that stops it. Each call should move toward that case.
  • Integer division and modulo in Python: 7 // 2 == 3, 7 % 2 == 1, and -7 // 2 == -4 (it rounds down).
  • Short-circuiting: a and b skips b if a is false. a or b skips b if a is true.
  • Off-by-one: range(1, 5) is 1, 2, 3, 4. The end isn't included.
  • Object-oriented ideas: encapsulation (hide state behind methods), inheritance (a subclass reuses a parent), polymorphism (one call, behaviour chosen by the object's type).
  • Git: a commit is a snapshot, a branch is a movable pointer to commits, and a merge joins two branches' histories.

What does f(4) return?

def f(n):
    return 1 if n <= 1 else n * f(n - 1)
  1. \(f(4)=4\cdot f(3)=4\cdot3\cdot f(2)=4\cdot3\cdot2\cdot f(1)\).
  2. \(f(1)=1\).

24

Object-oriented programming5

Class and object:
a class is a blueprint, and an object is one instance built from it.
Encapsulation:
bundle data with the methods that use it, and hide the data behind those methods (private fields, public methods).
Abstraction:
expose what an object does and hide how it does it.
Inheritance:
a subclass reuses and extends a parent class ("is-a": a Dog is an Animal).
Polymorphism:
one call, different behaviour depending on the object's actual type.
  • Overriding: a subclass replaces a parent's method with the same signature. Overloading: several methods share a name but take different parameters.
  • Interface: declares methods without implementing them. Abstract class: may mix implemented and unimplemented methods, and can't be instantiated.
  • Composition ("has-a": a Car has an Engine) is often preferred to inheritance because it couples classes less.
  • Access modifiers: public (anyone), protected (the class and its subclasses), private (the class only). Exact rules vary by language.
  • SOLID: single responsibility, open-closed, Liskov substitution, interface segregation, dependency inversion.

What does this print?

class Shape:
    def area(self): return 0
class Square(Shape):
    def __init__(self, s): self.s = s
    def area(self): return self.s * self.s

shapes = [Shape(), Square(3)]
print(sum(x.area() for x in shapes))
  1. Square overrides area, so each object runs its own version (polymorphism).
  2. \(0+9\).

9

Databases and SQL2

  • WHERE filters rows before grouping. HAVING filters groups after GROUP BY.
  • INNER JOIN keeps matching rows only. LEFT JOIN keeps every left row, with NULLs where there's no match.
  • Primary key: unique and not null. Foreign key: must match a key in another table.
  • NULL isn't equal to anything, even NULL: test it with IS NULL. COUNT(col) skips NULLs, and COUNT(*) counts every row.
  • Indexes speed up reads but slow down writes. Normalization removes duplicated data.
  • ACID: atomicity, consistency, isolation, durability. The isolation levels, from weakest: read uncommitted, read committed, repeatable read, serializable.2

Table orders(customer, amount) has rows (ann, 10), (ann, 30), (bo, 5). What does this return?

SELECT customer, SUM(amount) FROM orders
GROUP BY customer HAVING SUM(amount) > 20;
  1. Groups: ann = 40, bo = 5.
  2. HAVING keeps the groups over 20.

One row: (ann, 40)

Frontend3

  • Box model: content, then padding, border and margin. With box-sizing: border-box, width includes padding and border.
  • Specificity (strongest first): inline styles, IDs, then classes, attributes and pseudo-classes, then elements.3
  • Flexbox: justify-content aligns along the main axis, align-items along the cross axis. Grid lays out rows and columns together.
  • rem is relative to the root font size, em to the element's font size (the parent's, when setting font-size itself).
  • Most DOM events bubble from the target up through its ancestors.
  • In JavaScript, === compares without type conversion: 0 == "0" is true but 0 === "0" is false.
  • Accessibility: use semantic elements, give images alt text, and label form fields.

Which rule wins for the link: #nav .item a or .nav .item a?

  1. Specificity, counted as (IDs, classes, elements): (1, 1, 1) against (0, 2, 1).
  2. An ID beats any number of classes.

#nav .item a

Backend4

StatusMeaning
200 / 201 / 204OK / Created / No Content
301 / 304Moved Permanently / Not Modified
400Bad Request
401Unauthorized: not authenticated (who are you?)
403Forbidden: authenticated but not allowed
404 / 409 / 429Not Found / Conflict / Too Many Requests
500 / 503Internal Server Error / Service Unavailable
  • Idempotent methods give the same result when repeated: GET, PUT and DELETE are, POST isn't. GET is also safe: it changes nothing.4
  • Authentication proves who you are. Authorization decides what you may do.
  • Store passwords as slow, salted hashes (bcrypt, Argon2), never as plain text or fast hashes.4
  • Horizontal scaling adds machines behind a load balancer. Vertical scaling makes one machine bigger.
  • Common web vulnerabilities: injection, cross-site scripting (XSS), broken access control.

System design basics3,6 Medium–Hard

Load balancer:
spreads incoming requests across several servers, and stops sending to ones that fail health checks.
Reverse proxy:
sits in front of servers and receives clients' requests for them (for TLS, caching, routing). A forward proxy sits in front of clients and sends requests on their behalf.
Cache:
a fast copy of data close to where it's needed. A TTL (time to live) sets how long an entry stays. Invalidation removes entries that are out of date, and a stale cache serves old data.
CDN (content delivery network):
servers around the world that cache content near users, cutting latency and load on the origin server.
DNS:
turns domain names into IP addresses.
TLS and HTTPS:
TLS encrypts and authenticates a connection, and HTTPS is HTTP over TLS. SSL is TLS's older, deprecated predecessor, which is why people still say "SSL/TLS".
FTP and SFTP:
FTP transfers files with no encryption (port 21). SFTP transfers files over an encrypted SSH connection (port 22).
API gateway:
a single entry point that routes requests to back-end services and handles shared concerns like authentication and rate limiting.
IdeaIn short
Horizontal vs vertical scalingadd more machines vs make one machine bigger
Stateless servicekeeps no per-user state, so any instance can serve any request and scaling out is easy
Replicationcopies of the same data on several machines, for reads and failover
Shardingsplits data across machines, each holding part of it
CAP theoremduring a network partition, a distributed store must choose consistency or availability
Message queuelets work be done later and absorbs bursts, separating producers from consumers
Monolith vs microservicesone deployable app vs many small services that communicate over the network
Latency vs throughputtime for one request vs requests handled per second
Redundancy and failoverspare copies take over when one fails, so there's no single point of failure
WebSockets vs pollingone open two-way connection the server can push on vs the client asking repeatedly

A site's users are worldwide, but its one server is in Europe. Pages load slowly in Asia. What helps most?

  1. The delay comes from distance (latency), not from the server's capacity.
  2. A CDN caches the content on servers near each user.

Put a CDN in front of the site

trending_upEconomics

Markets, the whole economy, banks and investing. Questions test definitions, cause and effect, and quick calculations you can do in your head.

Microeconomics1

Core ideas

Scarcity:
resources are limited but wants are not, so every choice gives something up.
Opportunity cost:
the value of the next best alternative given up. An evening spent studying instead of working a $100 shift costs $100.
Marginal analysis:
compare the extra benefit of one more unit with its extra cost. Keep going while marginal benefit is at least marginal cost.
Sunk cost:
money already spent that can't be recovered. It shouldn't affect the next decision.
Comparative advantage:
producing something at a lower opportunity cost than others. Trade based on it helps both sides, even when one side has the absolute advantage (can produce more of everything).

Supply and demand

  • Law of demand: when the price rises, the quantity demanded falls. Law of supply: when the price rises, the quantity supplied rises.
  • Equilibrium is where supply equals demand. Above it, a surplus pushes the price down. Below it, a shortage pushes the price up.
  • Movement vs shift: a change in the good's own price moves along the curve (a change in quantity demanded). Anything else shifts the whole curve (a change in demand).
  • Demand shifters: income, tastes, prices of related goods, expectations, number of buyers. Supply shifters: input costs, technology, taxes and subsidies, expectations, number of sellers.
  • A normal good sells more when incomes rise. An inferior good (instant noodles, bus rides) sells less.
  • Substitutes (coffee and tea): if one gets pricier, demand for the other rises. Complements (printers and ink): if one gets pricier, demand for the other falls.
  • A price ceiling below equilibrium (rent control) causes a shortage. A price floor above it (minimum wage) causes a surplus. A ceiling above equilibrium, or a floor below it, does nothing.
ShiftPriceQuantity
Demand risesupup
Demand fallsdowndown
Supply risesdownup
Supply fallsupdown

Demand \(Q_d=100-2P\), supply \(Q_s=20+2P\). Find the equilibrium.

  1. \(100-2P=20+2P\), so \(4P=80\).
  2. \(P=20\), and \(Q=100-40\).

\(P=20\), \(Q=60\)

Elasticity

  • Elastic (\(|E_d|>1\)): buyers react strongly. Goods with many substitutes, luxuries, and big purchases. Inelastic (\(|E_d|<1\)): necessities with few substitutes, like gasoline or insulin.
  • Total revenue test: if demand is elastic, cutting the price raises revenue. If it's inelastic, raising the price raises revenue. Revenue peaks where \(|E_d|=1\).
  • Income elasticity is positive for normal goods (above 1 for luxuries) and negative for inferior goods.
  • Cross elasticity is positive for substitutes and negative for complements.
  • Tax incidence: whichever side of the market is less elastic pays more of a tax, no matter who it's collected from.
Price elasticity of demand\(E_d=\dfrac{\%\Delta Q_d}{\%\Delta P}\)
Income elasticity\(\dfrac{\%\Delta Q_d}{\%\Delta \text{income}}\)
Cross elasticity (good A to good B)\(\dfrac{\%\Delta Q_A}{\%\Delta P_B}\)
Total revenue\(TR=P\times Q\)

A price rises from $10 to $12 and the quantity sold falls from 100 to 90. Is demand elastic, and what happens to revenue?

  1. \(\%\Delta Q=-10\%\), \(\%\Delta P=+20\%\), so \(E_d=-0.5\): inelastic.
  2. Revenue: \(10\times100=1000\) becomes \(12\times90=1080\).

Inelastic. Revenue rises by $80.

Surplus and efficiency

Consumer surplus:
what buyers were willing to pay minus what they paid. The area under the demand curve and above the price.
Producer surplus:
the price sellers get minus the lowest price they'd accept. The area above the supply curve and below the price.
Total surplus:
consumer plus producer surplus. A competitive market at equilibrium makes it as large as possible.
Deadweight loss:
total surplus lost when a tax, price control, monopoly or externality pushes quantity away from the efficient level.
  • A tax drives a wedge between what buyers pay and what sellers keep. Fewer trades happen, creating deadweight loss.
Deadweight loss of a tax (straight-line curves)\(\tfrac12\times\text{tax}\times\Delta Q\)

With demand \(Q_d=100-2P\) and a market price of $20, what is consumer surplus?

  1. Nobody buys at \(P=50\) (set \(Q_d=0\)). At \(P=20\), \(Q=60\).
  2. The surplus is a triangle: \(\tfrac12\times60\times(50-20)\).

$900

Costs of production

Fixed cost:
doesn't change with output, like rent.
Variable cost:
rises with output, like materials.
Short run:
at least one input is fixed. Long run: every input can change.
Diminishing marginal returns:
adding more of one input to fixed inputs eventually adds less and less output.
Economic profit:
revenue minus explicit and implicit (opportunity) costs. Accounting profit subtracts explicit costs only. Zero economic profit (normal profit) still covers the owner's opportunity cost.
Economies of scale:
long-run average cost falls as output grows. With diseconomies of scale, it rises.
  • Marginal cost crosses average total cost and average variable cost at their lowest points.
Total cost\(TC=FC+VC\)
Average total cost\(ATC=\dfrac{TC}{Q}\)
Marginal cost\(MC=\dfrac{\Delta TC}{\Delta Q}\)
Profit\((P-ATC)\times Q\)

Market structures

StructureFirmsProductEntryPrice power
Perfect competitionmanyidenticalfreenone (price taker)
Monopolistic competitionmanydifferentiatedeasysome
Oligopolya fewidentical or differentiatedharda lot, but firms react to each other
Monopolyoneno close substitutesblockedprice maker
  • Firms maximize profit where marginal revenue = marginal cost. In perfect competition, \(P=MR=MC\). In the long run, entry and exit push price to the minimum of \(ATC\), so economic profit is zero.
  • Shutdown rule: in the short run, stop producing if \(P\) is below minimum \(AVC\). In the long run, leave the industry if \(P\) is below minimum \(ATC\).
  • A monopoly's \(MR\) is below its price, because selling one more unit means lowering the price on every unit. It produces less and charges more than a competitive market (\(P>MC\)), causing deadweight loss.
  • A natural monopoly (a water utility) can serve the whole market more cheaply than several firms could. Price discrimination charges different buyers different prices for the same good, like student discounts.
Dominant strategy:
the best move no matter what the other player does.
Nash equilibrium:
no player can do better by changing strategy alone.
Prisoner's dilemma:
each player's dominant strategy (cheat) leaves both worse off than if they'd cooperated. It's why cartel members are tempted to break agreed output limits.

A competitive firm faces a price of $8. Its minimum average variable cost is $6 and its minimum average total cost is $10. What should it do?

  1. \(P<ATC\), so it's losing money.
  2. \(P>AVC\), so producing covers its variable costs and part of its fixed costs. Shutting down would lose all the fixed costs.

Keep producing in the short run, leave in the long run.

Market failures

Externality:
a cost or benefit that falls on people outside the trade. With a negative one (pollution), the market produces too much. With a positive one (vaccines, education), too little.
Pigouvian tax:
a tax equal to the external cost, so producers pay the full social cost. A subsidy does the same for a positive externality.
Coase theorem:
if property rights are clear and bargaining is cheap, the people involved can fix an externality themselves.
Free rider:
someone who benefits without paying. This is why markets underprovide public goods.
Tragedy of the commons:
a shared resource gets overused because nobody owns it, like overfishing.
Asymmetric information:
one side knows more. Adverse selection happens before the deal (the used-car "lemons" problem). Moral hazard happens after it (insured people take more risks).
Type of goodRival?Excludable?Example
Privateyesyesa sandwich
Clubnoyesa streaming service
Common resourceyesnoocean fish
Publicnononational defense, street lights
Social costprivate cost + external cost

Macroeconomics1

Measuring output

GDP:
the market value of all final goods and services produced inside a country in a period.
Left out of GDP:
intermediate goods (they'd be counted twice), used goods, buying stocks or bonds, transfer payments like pensions, unpaid housework, and the underground economy.
GNP:
output by a country's residents and firms, wherever in the world it's produced.
Nominal vs real GDP:
nominal uses current prices. Real GDP uses base-year prices, so it only grows when output grows.
GDP per capita:
GDP divided by population. A rough measure of living standards.
  • In GDP, investment (\(I\)) means new equipment, buildings, housing and inventories, not buying shares. Government spending (\(G\)) leaves out transfer payments.
GDP (expenditure)\(Y=C+I+G+(X-M)\)
GDP deflator\(\dfrac{\text{nominal GDP}}{\text{real GDP}}\times100\)
Growth rate\(\dfrac{Y_2-Y_1}{Y_1}\times100\%\)

Nominal GDP is $1,100 billion and the GDP deflator is 110. What is real GDP?

  1. Real GDP \(=\dfrac{\text{nominal}}{\text{deflator}}\times100=\dfrac{1100}{110}\times100\).

$1,000 billion

Inflation

Inflation:
a sustained rise in the overall price level. Deflation is a falling price level. Disinflation is inflation slowing down but still positive.
CPI:
the Consumer Price Index tracks the cost of a fixed basket of goods a typical household buys. The base year is 100.
Core inflation:
inflation without food and energy prices, which jump around.
Demand-pull vs cost-push:
demand-pull is too much spending chasing too few goods. Cost-push comes from rising input costs, like oil.
  • Surprise inflation hurts lenders, savers and people on fixed incomes. It helps borrowers with fixed-rate loans, who repay in cheaper money.
  • The CPI tends to overstate inflation: people switch to cheaper goods, and quality improvements look like price rises.
Inflation rate\(\dfrac{CPI_2-CPI_1}{CPI_1}\times100\%\)
Real interest rate (Fisher)\(r\approx i-\pi\)
Quantity theory of money\(MV=PY\)

A savings account pays 5% and inflation is 3%. What is the real return?

  1. \(r\approx5\%-3\%\).

About 2%

Unemployment

Labor force:
people who are employed plus people who are unemployed and actively looking. Retirees, full-time students and discouraged workers (who stopped looking) aren't in it.
Frictional:
between jobs or just starting out. Structural: skills or location don't match the jobs available. Cyclical: caused by a recession.
Natural rate:
frictional plus structural unemployment. "Full employment" means unemployment is at this rate, not at zero.
Unemployment rate\(\dfrac{\text{unemployed}}{\text{labor force}}\times100\%\)
Participation rate\(\dfrac{\text{labor force}}{\text{working-age population}}\times100\%\)

190 million people are employed, 10 million are unemployed and 60 million are not in the labor force. What is the unemployment rate?

  1. Labor force \(=190+10=200\) million. The 60 million don't count.
  2. \(10\div200\).

5%

Aggregate demand and supply

  • Aggregate demand slopes down: a lower price level makes people's money worth more (wealth effect), lowers interest rates, and makes exports cheaper.
  • Short-run aggregate supply slopes up because some wages and prices are slow to change. Long-run aggregate supply is vertical at potential GDP, which depends on resources and technology, not prices.
  • A recessionary gap is output below potential. An inflationary gap is output above it.
  • Stagflation is rising prices and falling output together, usually from a supply shock like the 1970s oil crises.
ShockPrice levelReal GDP
Aggregate demand risesupup
Aggregate demand fallsdowndown
Short-run supply falls (oil shock)updown
Short-run supply risesdownup

Business cycles and growth

  • The four phases of a business cycle are expansion, peak, contraction (recession) and trough.
  • A common rule of thumb calls two quarters in a row of falling real GDP a recession. In the US, the NBER officially dates them using wider data such as jobs and income.
  • Leading indicators (stock prices, building permits) move before the economy does. Lagging indicators (the unemployment rate) move after.
  • Long-run growth comes from more physical capital, more human capital (education and skills), better technology, and institutions like property rights. Productivity, meaning output per hour worked, drives living standards.
Rule of 70years to double \(\approx\dfrac{70}{\text{growth rate in }\%}\)

Real GDP per person grows 2% a year. About how long until it doubles?

  1. \(70\div2\).

About 35 years

Fiscal and monetary policy

  • Fiscal policy uses government spending and taxes. Monetary policy uses interest rates and the money supply.
  • Expansionary policy (more spending, tax cuts, lower rates) fights recessions. Contractionary policy (the opposite) fights inflation.
  • Automatic stabilizers, like unemployment insurance and progressive taxes, push against the cycle without any new law.
  • Crowding out: heavy government borrowing can raise interest rates and reduce private investment.
  • A budget deficit is one year's spending above revenue. The national debt is the total of past deficits minus surpluses.
  • The US Federal Reserve has a dual mandate: maximum employment and stable prices. It aims for 2% inflation over the long run.2
  • The short-run Phillips curve shows a trade-off between inflation and unemployment. In the long run it's vertical at the natural rate, so there's no lasting trade-off.
Spending multiplier\(\dfrac{1}{1-MPC}\)
Tax multiplier\(\dfrac{-MPC}{1-MPC}\)
Spending or saving each extra dollar\(MPC+MPS=1\)

MPC is 0.8. By how much can $10 billion of new government spending raise GDP?

  1. Multiplier \(=\tfrac{1}{1-0.8}=5\).
  2. \(5\times 10\).

$50 billion (in the simple model)

Trade and exchange rates

Trade balance:
exports minus imports. A trade deficit means a country imports more than it exports.
Balance of payments:
a country's record of transactions with the rest of the world. The current account (trade, investment income, transfers) and the financial account (buying and selling assets) roughly cancel out. A current account deficit is paid for by foreigners buying domestic assets.
Appreciation:
a currency buys more foreign currency than before. Exports get pricier abroad and imports get cheaper. Depreciation is the opposite.
Floating vs fixed:
a floating exchange rate is set by the market. A fixed (pegged) rate is held by the central bank.
Purchasing power parity:
in the long run, exchange rates tend to move until the same basket costs the same everywhere.
Tariff:
a tax on imports. A quota limits the quantity imported.

The exchange rate moves from 1 USD = 1.30 CAD to 1 USD = 1.40 CAD. Which currency appreciated, and what does a 130 CAD jacket now cost in USD?

  1. Each US dollar buys more Canadian dollars, so the USD appreciated.
  2. Before: \(130\div1.30=100\). After: \(130\div1.40\approx92.86\).

The USD. The jacket drops from $100 to about $92.86.

Banking1,2

Money

Functions of money:
a medium of exchange, a unit of account and a store of value.
M1:
cash in circulation plus checking deposits (and, since 2020 in the US, savings deposits). M2 adds small time deposits and retail money market funds.
Liquidity:
how quickly something can be turned into cash without losing value. Cash is the most liquid asset. A house is illiquid.

How banks work

  • Fractional reserve banking: banks lend out most deposits. Each loan ends up deposited at another bank, which lends part of it again, so lending creates money.
  • The simple money multiplier is \(\tfrac{1}{\text{reserve ratio}}\). In practice money grows less, because banks keep extra reserves and people hold cash.
  • A bank balance sheet: assets = liabilities + equity. Loans, reserves and bonds are the bank's assets. Deposits and borrowed money are its liabilities.
  • Banks earn the gap between the interest on loans and the interest paid on deposits, called the net interest margin.
  • Maturity mismatch: banks borrow short (deposits can leave any day) and lend long (30-year mortgages).
  • Commercial banks take deposits and make loans. Investment banks help companies issue stocks and bonds, advise on mergers and trade securities. Credit unions are owned by their members.
Bank capital:
the equity cushion that absorbs losses. Under Basel III, banks must hold common equity of at least 4.5% of risk-weighted assets, or 7% with the required conservation buffer.5
Insolvent vs illiquid:
an insolvent bank's assets are worth less than its liabilities. An illiquid bank is solvent but can't raise cash fast enough.
Bank run:
many depositors pull money out at once for fear the bank will fail. Loans can't be sold quickly, so even a healthy bank can fall. Silicon Valley Bank failed after a run in March 2023.
Leverage:
assets divided by equity. The higher it is, the smaller the loss that wipes out the bank's equity.

A bank has $100 million in assets and $92 million in liabilities. Then $10 million of its loans go bad. Is it still solvent?

  1. Equity \(=100-92=8\) million.
  2. After the loss: assets \(=90\), so equity \(=90-92=-2\) million.

No. Its equity is −$2 million, so it's insolvent.

Central banks

  • Central bank tools (the US Federal Reserve): open market operations, the policy rate target, and interest on reserve balances. The Fed cut reserve requirements to 0% in March 2020.2
  • Open market operations: buying government bonds adds reserves and pushes interest rates down. Selling them does the opposite.
  • The federal funds rate is what banks charge each other for overnight loans of reserves. The Fed sets a target range, and changes flow through to mortgage, car-loan and savings rates.
  • As lender of last resort, a central bank lends to banks in trouble, in the US through the discount window.
  • Quantitative easing: large purchases of longer-term bonds when short-term rates are already near zero.
  • FDIC deposit insurance covers $250,000 per depositor, per insured bank, per ownership category.2 It stops most runs before they start.

Interest and loans

APR vs APY:
APR is the yearly rate without compounding. APY includes compounding, so it's higher whenever interest compounds more than once a year.
Amortization:
each fixed loan payment covers that period's interest first, and the rest pays down the principal. Early payments are mostly interest, later ones mostly principal.
Secured vs unsecured:
a secured loan is backed by collateral (a mortgage, a car loan). An unsecured loan (a credit card) isn't, so it charges more.
Fixed vs variable rate:
a fixed rate stays the same for the whole loan. A variable rate follows a benchmark rate.
Credit risk:
the chance a borrower won't repay (defaults). Riskier borrowers pay higher rates, and a credit score sums up a borrower's history.
Simple interest\(A=P(1+rt)\)
Compound interest\(A=P\left(1+\tfrac{r}{n}\right)^{nt}\)
APY\(\left(1+\tfrac{r}{n}\right)^{n}-1\)
Loan payment (rate \(r\) per period, \(n\) payments)\(M=P\,\dfrac{r(1+r)^n}{(1+r)^n-1}\)
Rule of 72years to double \(\approx\dfrac{72}{\text{rate in }\%}\)

$1000 at 10% a year for 2 years: compound against simple?

  1. Compound: \(1000\times1.1^2=1210\).
  2. Simple: \(1000\times(1+0.2)=1200\).

$1210 against $1200

A $200,000 mortgage charges 6% a year, paid monthly. How much of the first payment is interest?

  1. Monthly rate \(=6\%\div12=0.5\%\).
  2. \(200{,}000\times0.005\).

$1,000

Trading and investing3,4

Stocks

Stock:
a share of ownership (equity) in a company. Common stock usually votes. Preferred stock usually doesn't, but its dividends are paid first.
Market capitalization:
share price times shares outstanding. The market's value of the whole company.
IPO:
a company's first sale of shares to the public. New shares are sold in the primary market. Investors then trade them with each other in the secondary market, on exchanges like the NYSE and Nasdaq.
Dividend:
a share of profits paid to shareholders. You must own the stock before the ex-dividend date to get the next one.
Stock split:
more shares at a lower price, same total value. After a 2-for-1 split, one $100 share becomes two $50 shares.
Buyback:
a company buys its own shares, so fewer are outstanding.
Earnings per share\(EPS=\dfrac{\text{net income}-\text{preferred dividends}}{\text{shares outstanding}}\)
Price-to-earnings ratio\(P/E=\dfrac{\text{share price}}{\text{earnings per share}}\)
Dividend yield\(\dfrac{\text{annual dividend}}{\text{share price}}\)
Total return\(\dfrac{P_1-P_0+D}{P_0}\)

A $50 stock earns $2.50 per share. What is its P/E?

  1. \(50\div2.5\).

20

You buy a stock at $40, collect a $1 dividend and sell at $44. What is your total return?

  1. Gain \(=44-40+1=5\).
  2. \(5\div40\).

12.5%

Bonds

Bond:
a loan to a government or company (debt). The face value (often $1,000) is repaid at maturity. The coupon rate sets the yearly interest as a percentage of face value.
Yield to maturity:
the yearly return if you buy at today's price and hold until maturity.
Premium vs discount:
a bond trades above face value when its coupon beats current rates, and below face value when it doesn't.
Zero-coupon bond:
pays no coupons. It's sold below face value and pays the full face value at maturity.
US Treasuries:
bills mature within a year, notes in 2 to 10 years, bonds in 20 or 30 years.
Credit rating:
BBB− (or Baa3) and above is investment grade. Below that is high yield ("junk"), which pays more for its higher risk of default.
Yield curve:
yields plotted by maturity. It usually slopes up. An inverted curve, with short rates above long rates, has often come before recessions.
  • When interest rates rise, existing bond prices fall. Longer bonds fall more.
Current yield\(\dfrac{\text{annual coupon}}{\text{bond price}}\)
Zero-coupon price\(\dfrac{F}{(1+y)^n}\)

A bond with $1,000 face value and a 5% coupon trades at $800. What is its current yield?

  1. Coupon \(=5\%\times1000=50\) a year.
  2. \(50\div800\).

6.25%, above the coupon rate because the bond trades at a discount

Orders and markets

  • A market order fills right away at the best available price. A limit order fills only at your price or better. A stop order becomes a market order once the price hits your stop, often to limit losses (a stop-loss).
  • The bid-ask spread is the gap between the highest bid and the lowest ask. It's wider in thinly traded markets.
  • Liquidity means you can trade quickly near the last price. Volume is how many shares trade in a period. Higher volume usually means tighter spreads.
  • A bull market is a long rise. A bear market is a fall of 20% or more from a recent high. A correction is a drop of about 10%.
  • Market indices: the S&P 500 tracks 500 large US companies, weighted by market cap. The Dow Jones Industrial Average tracks 30, weighted by share price. The Nasdaq Composite covers stocks listed on the Nasdaq and leans toward tech.
  • An index fund or ETF copies an index cheaply. ETFs trade all day on an exchange. Mutual funds are priced once a day at their net asset value.

Options and futures

Call option:
the right to buy at the strike price before expiration. A put is the right to sell. The buyer pays a premium, which is the most they can lose.
In the money:
a call whose stock trades above the strike, or a put whose stock trades below it.
American vs European:
an American option can be used any time before expiration. A European one only at expiration.
Futures:
an obligation to buy or sell later at a set price. Futures are standardized, traded on exchanges and settled daily. Forwards are private, custom versions.
Hedging vs speculating:
hedging uses derivatives to cut risk, like a farmer selling wheat futures to lock in a price. Speculating bets on where prices will go.
Call payoff at expiration\(\max(S-K,\,0)\)
Put payoff at expiration\(\max(K-S,\,0)\)
Option profitpayoff − premium

You buy a call with a $50 strike for a $3 premium. At expiration the stock is $58. What is your profit per share?

  1. Payoff \(=58-50=8\).
  2. Profit \(=8-3\).

$5 per share

Risk, return and leverage

  • Risk and return go together: higher expected returns come with more risk. Short-term government bills are treated as the risk-free rate.
  • Volatility is how much returns swing, measured by standard deviation.
  • Diversification reduces company-specific (unsystematic) risk, but not market-wide (systematic) risk.
  • Beta measures how a stock moves with the market. \(\beta=1\) moves with it, \(\beta=1.5\) swings 50% more, and \(\beta<1\) swings less.
  • Short selling: sell borrowed shares, hoping to buy them back cheaper. The possible loss has no limit, because the price can keep rising.
  • Buying on margin means borrowing from your broker to buy more. Leverage magnifies gains and losses. If your equity falls too far, you get a margin call to add money.
Expected return (CAPM)\(E(R)=R_f+\beta\,\big(E(R_m)-R_f\big)\)

The risk-free rate is 3%, the market is expected to return 8%, and a stock's beta is 1.2. What return does CAPM expect?

  1. Market risk premium \(=8-3=5\%\).
  2. \(3+1.2\times5\).

9%

You buy $10,000 of stock using $5,000 of your own money and a $5,000 margin loan. The stock falls 20%. How much of your own money did you lose (ignoring interest)?

  1. The stock is now worth \(8000\). After repaying 5000, you have 3000 left.
  2. You lost \(2000\) of \(5000\).

40%, twice the stock's drop

precision_manufacturingEngineering

Mechanics, circuits and heat. Many questions ask what a formula means, not just how to use it. The examples use \(g\approx9.8\) m/s².

Statics1,2

Basics

Statics:
the study of bodies that aren't accelerating, usually at rest.
Scalar vs vector:
a scalar has only a size (mass, temperature). A vector has a size and a direction (force, velocity).
Force:
a push or pull, measured in newtons: \(1\text{ N}=1\text{ kg}\cdot\text{m/s}^2\).
Weight:
the force of gravity on a mass, \(W=mg\). A 10 kg box weighs about 98 N.
Rigid body:
an object that doesn't deform under load. Statics problems usually assume this.
Free-body diagram:
a sketch of one body on its own, showing every external force and support reaction acting on it. Start every problem with one.
Newton's third law:
every force has an equal and opposite reaction on the other body.

Forces and components

  • Split a force \(F\) at angle \(\theta\) from the \(x\)-axis into \(F_x=F\cos\theta\) and \(F_y=F\sin\theta\).
  • To add forces, add their \(x\) parts and their \(y\) parts separately, then combine them into the resultant.
Resultant size\(R=\sqrt{R_x^2+R_y^2}\)
Resultant direction\(\theta=\tan^{-1}\!\dfrac{R_y}{R_x}\)

A 10 N force acts at 30° above the horizontal. Find its components.

  1. \(F_x=10\cos30^\circ\approx8.66\) N.
  2. \(F_y=10\sin30^\circ=5\) N.

8.66 N horizontal, 5 N vertical

Equilibrium and moments

  • Equilibrium: \(\sum F=0\) and \(\sum M=0\). In 2D that's three equations (\(\sum F_x=0\), \(\sum F_y=0\), \(\sum M=0\)), so you can solve for at most three unknowns.
  • Moment: \(M=F\cdot d\), with \(d\) the perpendicular distance from the point to the force's line of action. Counterclockwise is usually positive.
  • Take moments about a point where unknown forces act. Those forces drop out of the equation.
  • A couple (two equal, opposite, offset forces) creates a pure moment and no net force. Its moment is the same about every point.
  • A two-force member has forces only at two points, so the forces must be equal, opposite and along the line joining those points.
  • A structure is statically indeterminate when it has more unknown reactions than equilibrium equations.
Support (2D)UnknownsWhat it resists
Cable or rope1pulling along the cable only (tension)
Roller1force perpendicular to the surface
Pin2force in any direction (\(x\) and \(y\))
Fixed (built-in)3\(x\) force, \(y\) force and a moment

A 4 m beam on supports A and B carries 10 N at 1 m from A. Find the reactions.

  1. Moments about A: \(R_B\cdot4=10\cdot1\), so \(R_B=2.5\) N.
  2. Vertical forces: \(R_A=10-2.5\).

\(R_A=7.5\) N, \(R_B=2.5\) N

Friction

  • Static friction holds a body still and adjusts up to a maximum, \(f\le\mu_s N\). Kinetic friction acts once it slides, \(f_k=\mu_k N\). Usually \(\mu_k<\mu_s\), which is why it's harder to start a push than to keep going.
  • Friction opposes the motion (or the motion that's about to happen). In the simple model, it doesn't depend on contact area.
  • A block about to slip on an incline has \(\mu_s=\tan\theta\).

A 10 kg crate sits on a floor with \(\mu_s=0.4\). What horizontal push starts it moving?

  1. \(N=mg=10\times9.8=98\) N.
  2. \(f_{max}=0.4\times98\).

Just over 39.2 N

Trusses and pulleys

  • In an ideal truss, members are two-force members joined by pins, so each one is either in tension (pulled) or compression (pushed).
  • Method of joints: apply equilibrium at each pin, starting at a joint with no more than two unknowns. Method of sections: cut through no more than three members and take moments.
  • Zero-force members: at an unloaded joint with only two members that aren't in line, both carry zero force. At an unloaded joint with three members, two of them in line, the third carries zero force.
  • An ideal pulley only changes the direction of a rope. The tension is the same all along one rope.
  • A single movable pulley halves the force needed, because two rope segments hold up the load.

Distributed loads, centroids and moment of inertia

Distributed load:
a load spread along a length, in N/m. Replace it with one force equal to the area under the load diagram, acting at that area's centroid.
Centroid:
the geometric center of an area.
Center of gravity:
the point where the total weight acts. For a uniform material, it's at the centroid.
Area moment of inertia:
how well a cross-section resists bending. Area far from the axis counts most, which is why I-beams put most of their material in the flanges.
Uniform load \(w\) over length \(L\)resultant \(wL\) at \(\tfrac{L}{2}\)
Triangular load, peak \(w\)resultant \(\tfrac12wL\) at \(\tfrac{L}{3}\) from the tall end
Centroid of a composite area\(\bar x=\dfrac{\sum x_iA_i}{\sum A_i}\)
Rectangle, centroidal axis\(I=\dfrac{bh^3}{12}\)
Parallel axis theorem\(I=I_c+Ad^2\)
  • Because \(I\) grows with \(h^3\), doubling a beam's depth makes it 8 times stiffer in bending, while doubling its width only doubles it.

A 4 m beam on supports at each end carries a uniform load of 5 kN/m. Find the reactions.

  1. Resultant \(=5\times4=20\) kN, acting at the 2 m midpoint.
  2. The load is symmetric, so each support takes half.

10 kN at each support

Dynamics1

Describing motion

Distance vs displacement:
distance is the total path length (a scalar). Displacement is the straight-line change in position, with a direction (a vector).
Speed vs velocity:
speed is how fast. Velocity is how fast and in which direction.
Acceleration:
the rate of change of velocity, in m/s². Speeding up, slowing down and turning are all acceleration.
Free fall:
motion under gravity alone, with \(a=g\approx9.8\) m/s² downward (ignoring air).
Relative velocity:
the velocity of A as seen from B, \(v_{A/B}=v_A-v_B\).
Constant acceleration\(v=v_0+at,\quad x=v_0t+\tfrac12at^2,\quad v^2=v_0^2+2a\Delta x\)

A car starts from rest and accelerates at 2 m/s² for 5 s. How fast is it going, and how far has it gone?

  1. \(v=0+2\times5=10\) m/s.
  2. \(x=\tfrac12\times2\times5^2=25\) m.

10 m/s after 25 m

Projectile motion

  • Horizontal and vertical motion are independent. Horizontal velocity stays constant, and vertical velocity changes by \(g\) each second.
  • At the top of its path, a projectile's vertical velocity is zero. Its horizontal velocity isn't.
  • On level ground, the range is greatest at a 45° launch angle, and angles that add to 90° (30° and 60°) give the same range.
Range on level ground\(R=\dfrac{v_0^2\sin2\theta}{g}\)
Time to fall height \(h\) from rest\(t=\sqrt{\dfrac{2h}{g}}\)

A ball rolls off a 4.9 m high ledge at 3 m/s. How far from the base does it land?

  1. Fall time: \(t=\sqrt{2\times4.9/9.8}=1\) s.
  2. Horizontal distance: \(3\times1\).

3 m

Forces and Newton's laws

  • First law (inertia): a body keeps its velocity unless a net force acts on it. Second law: \(F_{net}=ma\). Third law: forces come in equal, opposite pairs acting on different bodies.
  • Mass (kg) is the amount of matter and doesn't change. Weight (N) is \(mg\) and depends on gravity.
  • The normal force pushes perpendicular to a surface. Tension pulls along a rope.
  • On an incline, gravity splits into \(mg\sin\theta\) along the slope and \(mg\cos\theta\) into it.
  • In circular motion, a net force toward the center is needed (centripetal force). It isn't a new force: tension, friction, gravity or the normal force supplies it.
Newton's second law\(F=ma\)
Circular motion\(a_c=\dfrac{v^2}{r},\quad F_c=\dfrac{mv^2}{r},\quad T=\dfrac{2\pi r}{v}\)

A 1000 kg car takes a curve of radius 50 m at 10 m/s. What sideways friction force does it need?

  1. \(a_c=10^2/50=2\) m/s².
  2. \(F=1000\times2\).

2000 N toward the center

Work, energy and power

Work:
force times distance along the force, in joules. A force perpendicular to the motion does no work.
Work-energy theorem:
the net work on a body equals its change in kinetic energy.
Conservation of energy:
without friction, \(KE+PE\) stays constant. Friction turns mechanical energy into heat.
Power:
the rate of doing work, in watts (\(1\text{ W}=1\text{ J/s}\)).
Efficiency:
useful energy out divided by energy in. It's always below 100%.
Energy\(KE=\tfrac12mv^2,\quad PE=mgh,\quad W=Fd\cos\theta\)
Power\(P=\dfrac{W}{t}=Fv\)
Springs\(F=-kx,\quad PE=\tfrac12kx^2\)

A ball is dropped from 5 m. How fast is it going when it hits the ground?

  1. \(mgh=\tfrac12mv^2\), so \(v=\sqrt{2gh}\).
  2. \(\sqrt{2\times9.8\times5}=\sqrt{98}\).

About 9.9 m/s, whatever its mass

Momentum and collisions

  • Momentum is conserved in every collision. Kinetic energy is conserved only in elastic ones.
  • Doubling speed doubles momentum but quadruples kinetic energy.
  • Impulse is force times time. Airbags and crumple zones stretch out the stopping time, which lowers the force.
CollisionMomentumKinetic energyExample
Elasticconservedconservedbilliard balls (nearly)
Inelasticconservedsome losta car crash
Perfectly inelasticconservedmost lost, bodies stick togethera dart hitting a board
Momentum and impulse\(p=mv,\quad J=F\Delta t=\Delta p\)

A 2 kg cart at 3 m/s is stopped in 1 s. What average force stopped it?

  1. \(\Delta p=2\times3=6\) kg·m/s.
  2. \(F=\Delta p/\Delta t=6/1\).

6 N

A 2 kg cart at 3 m/s hits a 1 kg cart at rest, and they stick together. How fast do they move?

  1. Momentum before: \(2\times3=6\) kg·m/s.
  2. After: \(3v=6\).

2 m/s

Rotation and oscillation

Angular velocity:
\(\omega\), in rad/s. A point at radius \(r\) moves at \(v=r\omega\).
Torque:
the turning effect of a force, \(\tau=rF\sin\theta\).
Moment of inertia:
\(I=\sum mr^2\), a body's resistance to angular acceleration. Mass far from the axis counts most.
Angular momentum:
\(L=I\omega\), conserved without outside torque. A skater pulling in their arms lowers \(I\), so they spin faster.
Simple harmonic motion:
back-and-forth motion where the restoring force is proportional to the displacement, like a mass on a spring. The period doesn't depend on how far it swings.
Rotational second law\(\tau=I\alpha\)
Rotational kinetic energy\(KE=\tfrac12I\omega^2\)
Mass on a spring\(\omega=\sqrt{k/m},\quad T=2\pi\sqrt{\dfrac{m}{k}}\)
Pendulum (small swings)\(T=2\pi\sqrt{\dfrac{L}{g}},\quad f=\dfrac1T\)

What is the period of a 1 m pendulum?

  1. \(T=2\pi\sqrt{1/9.8}\approx2\pi\times0.32\).

About 2 s

Electrical circuits1,3

Basics

Charge:
measured in coulombs (C). One electron carries \(-1.6\times10^{-19}\) C.
Current:
the rate charge flows, in amperes (\(1\text{ A}=1\text{ C/s}\)). Conventional current flows from + to −, opposite to the electrons.
Voltage:
the energy per unit charge between two points (\(1\text{ V}=1\text{ J/C}\)). It's what pushes current through a circuit.
Resistance:
how much a component opposes current, in ohms (Ω). A longer or thinner wire has more.
Short vs open circuit:
a short is a path with almost no resistance, so current gets very large. An open circuit has a break, so no current flows.
Ground:
the reference point the circuit calls 0 V.
Meters:
a voltmeter goes in parallel and ideally draws no current. An ammeter goes in series and ideally has no resistance.
QuantitySymbolUnit
Charge\(Q\)coulomb (C)
Current\(I\)ampere (A)
Voltage\(V\)volt (V)
Resistance\(R\)ohm (Ω)
Power\(P\)watt (W)
Capacitance\(C\)farad (F)
Inductance\(L\)henry (H)
Frequency\(f\)hertz (Hz)
SI prefixesp \(10^{-12}\), n \(10^{-9}\), µ \(10^{-6}\), m \(10^{-3}\), k \(10^{3}\), M \(10^{6}\), G \(10^{9}\)
Ohm's law and power\(V=IR,\quad P=VI=I^2R=\tfrac{V^2}{R}\)
Resistance of a wire\(R=\dfrac{\rho L}{A}\)
Energy used\(E=Pt\) (1 kWh \(=3.6\) MJ)

Series and parallel

  • In series the current is the same through each part, and the voltages add. In parallel the voltage is the same across each branch, and the currents add.
  • Adding a resistor in parallel always lowers the total resistance. The total is smaller than the smallest branch.
  • Two equal resistors in parallel give half of one: \(R\parallel R=\tfrac{R}{2}\).
Series and parallel\(R_s=R_1+R_2,\quad \tfrac{1}{R_p}=\tfrac{1}{R_1}+\tfrac{1}{R_2}\)
Two in parallel\(R_p=\dfrac{R_1R_2}{R_1+R_2}\)
Voltage divider\(V_2=V\dfrac{R_2}{R_1+R_2}\)
Current divider\(I_1=I\dfrac{R_2}{R_1+R_2}\)

12 V across 2 Ω and 4 Ω in series. Current, and voltage across the 4 Ω?

  1. \(R=6\) Ω, so \(I=12/6=2\) A.
  2. \(V=2\times4\).

2 A and 8 V

A 6 Ω and a 3 Ω resistor are in parallel across 12 V. What is the total current?

  1. \(R_p=\tfrac{6\times3}{6+3}=2\) Ω.
  2. \(I=12/2\).

6 A (2 A through the 6 Ω, 4 A through the 3 Ω)

Circuit laws and equivalents

  • Kirchhoff's current law: the current into a node equals the current out. Voltage law: the voltages around any loop sum to zero.
  • Thevenin equivalent: \(V_{th}\) is the open-circuit voltage, and \(R_{th}\) is the resistance seen with independent sources turned off.
  • Norton equivalent: a current source \(I_N=V_{th}/R_{th}\) in parallel with \(R_{th}\). It behaves the same as the Thevenin version.
  • Maximum power transfer: a load gets the most power when its resistance equals \(R_{th}\).

Capacitors and inductors

Capacitor:
two conductors separated by an insulator. It stores energy in an electric field. Its voltage can't jump instantly, and once DC settles it acts like an open circuit.
Inductor:
a coil of wire. It stores energy in a magnetic field. Its current can't jump instantly, and once DC settles it acts like a plain wire.
Time constant:
how fast an RC or RL circuit responds. After one \(\tau\), a charging capacitor reaches about 63% of its final voltage. After about \(5\tau\) it's essentially full.
  • Capacitors combine the opposite way to resistors: in parallel they add, in series they combine like resistors in parallel. Inductors combine like resistors.
Capacitor\(Q=CV,\quad E=\tfrac12CV^2,\quad \tau=RC\)
Inductor\(V=L\dfrac{di}{dt},\quad E=\tfrac12LI^2,\quad \tau=\dfrac{L}{R}\)
Charging capacitor\(v(t)=V\left(1-e^{-t/\tau}\right)\)

A 10 kΩ resistor charges a 100 µF capacitor. What is the time constant, and about how long until it's fully charged?

  1. \(\tau=10{,}000\times0.0001=1\) s.
  2. Fully charged after about \(5\tau\).

1 s, and about 5 s

AC circuits

Alternating current:
current that reverses direction in a sine wave. Homes in North America get 120 V at 60 Hz, and most of Europe 230 V at 50 Hz.
Period and frequency:
\(T=\tfrac1f\). Angular frequency is \(\omega=2\pi f\).
RMS value:
the DC value that would deliver the same power. Mains voltages are quoted as RMS.
Impedance:
\(Z\), the AC version of resistance, in ohms. Reactance is the part from capacitors and inductors.
  • An inductor's reactance grows with frequency, so it blocks high frequencies. A capacitor's shrinks with frequency, so it blocks low frequencies and DC.
  • In an inductor, voltage leads current by 90°. In a capacitor, current leads voltage by 90°.
Sine wave RMS\(V_{rms}=\dfrac{V_{peak}}{\sqrt2}\)
Reactance\(X_L=\omega L,\quad X_C=\dfrac{1}{\omega C}\)
Series RLC impedance\(|Z|=\sqrt{R^2+(X_L-X_C)^2}\)

A household outlet supplies 120 V RMS. What is the peak voltage?

  1. \(V_{peak}=\sqrt2\times120\approx1.414\times120\).

About 170 V

Thermodynamics1

Basics

Temperature:
a measure of the average kinetic energy of the particles.
Heat:
energy that moves because of a temperature difference, always from hot to cold on its own. A body doesn't "contain" heat. It has internal energy.
Zeroth law:
if A and B are each in thermal equilibrium with C, they're in equilibrium with each other. That's what makes thermometers work.
System types:
an open system exchanges mass and energy with its surroundings, a closed system only energy, an isolated system neither.
Specific heat:
the energy to warm 1 kg by 1 K. Water's is high, about 4186 J/(kg·K), so it heats and cools slowly.
Latent heat:
the energy to change phase (melt or boil) without changing temperature.
Point°CK°F
Absolute zero−273.150−459.67
Water freezes0273.1532
Water boils (1 atm)100373.15212
Kelvin\(T_K=T_{^\circ C}+273.15\)
Fahrenheit\(T_{^\circ F}=\tfrac95T_{^\circ C}+32\)
Heat\(Q=mc\Delta T,\quad Q=mL\) (phase change)
  • During a phase change, added heat changes the internal energy, not the temperature.
  • Gas law calculations always use kelvin, never Celsius.

How much heat warms 2 kg of water from 20 °C to 70 °C?

  1. \(Q=mc\Delta T=2\times4186\times50\).

418,600 J, about 419 kJ

The first law and gas processes

  • First law: energy is conserved. Heat added to a system either raises its internal energy or comes out as work.
  • For an ideal gas, internal energy depends only on temperature.
  • On a pressure-volume graph, the work done by a gas is the area under its path.
First law\(\Delta U=Q-W\) (\(W\) done by the system)
Ideal gas\(PV=nRT,\quad R=8.314\) J/(mol·K)
Fixed amount of gas\(\dfrac{P_1V_1}{T_1}=\dfrac{P_2V_2}{T_2}\)
ProcessHeld constantWork by the gasWhat the first law gives
Isothermaltemperature\(nRT\ln\frac{V_2}{V_1}\)\(\Delta U=0\), so \(Q=W\)
Isobaricpressure\(P\Delta V\)\(\Delta U=Q-P\Delta V\)
Isochoricvolume0\(\Delta U=Q\)
Adiabaticno heat flow (\(Q=0\))\(-\Delta U\)expanding gas cools, compressed gas warms

A gas at a constant 100 kPa expands from 1 m³ to 3 m³ while absorbing 500 kJ of heat. Find the work done and the change in internal energy.

  1. \(W=P\Delta V=100\times2=200\) kJ.
  2. \(\Delta U=500-200\).

\(W=200\) kJ, \(\Delta U=300\) kJ

The second law, engines and refrigerators

Second law:
the entropy of an isolated system never decreases. Heat never flows from cold to hot on its own, and no engine turns heat fully into work.1
Entropy:
a measure of disorder, or of how many ways the energy can be spread out.
Heat engine:
takes heat \(Q_H\) from a hot source, turns part into work, and dumps the rest \(Q_C\) to a cold sink.
Refrigerator and heat pump:
use work to move heat from cold to hot. A fridge is rated by the heat it removes, a heat pump by the heat it delivers.
Carnot cycle:
an ideal, reversible cycle of two isothermal and two adiabatic steps. No engine between the same two temperatures can beat its efficiency.
Third law:
a perfect crystal at absolute zero has zero entropy, and absolute zero can't actually be reached.
Energy balance\(Q_H=W+Q_C\)
Efficiency\(e=\dfrac{W}{Q_H},\quad e_{Carnot}=1-\dfrac{T_C}{T_H}\)
COPfridge \(\dfrac{Q_C}{W}\), heat pump \(\dfrac{Q_H}{W}\)
Entropy change at constant \(T\)\(\Delta S=\dfrac{Q}{T}\)

What is the best possible efficiency of an engine between 600 K and 300 K?

  1. \(1-\tfrac{300}{600}\).

50%

A fridge removes 300 J from its inside using 100 J of work. What is its COP, and how much heat goes into the kitchen?

  1. \(COP=300/100=3\).
  2. \(Q_H=W+Q_C=100+300\).

COP 3, and 400 J into the kitchen

Heat transfer

Conduction:
heat passing through a material by direct contact, mainly in solids.
Convection:
heat carried by a moving fluid (liquid or gas), like warm air rising.
Radiation:
heat carried by electromagnetic waves. It needs no medium, which is how the Sun heats the Earth.
Thermal conductivity:
\(k\), how easily a material conducts heat. Metals are high (copper is about 400 W/(m·K)). Air and foam are low, so they insulate.
Conduction\(\dfrac{Q}{t}=\dfrac{kA\Delta T}{L}\)
Radiation (Stefan–Boltzmann)\(P=\varepsilon\sigma AT^4\)
  • Doubling a wall's thickness halves the heat conducted through it. Doubling an object's absolute temperature multiplies its radiated power by 16.

A 1 m² glass window is 4 mm thick with \(k=0.8\) W/(m·K). It's 20 °C warmer inside than outside. How fast does heat leak out?

  1. \(\tfrac{Q}{t}=\tfrac{0.8\times1\times20}{0.004}\).

4000 W

biotechBiology

Cells, energy and inheritance, starting from the basics.

Cell biology1

Basics

Cell theory:
all living things are made of cells, the cell is the basic unit of life, and every cell comes from an existing cell.
Prokaryote:
a cell with no nucleus and no membrane-bound organelles. Bacteria and archaea.
Eukaryote:
a cell with a nucleus and membrane-bound organelles. Animals, plants, fungi and protists.
Organelle:
a structure inside a cell with a specific job, like a tiny organ.
Cytoplasm:
everything inside the membrane except the nucleus. The fluid part is the cytosol.
Surface area to volume:
as a cell grows, its volume grows faster than its surface. Small cells can move nutrients and waste across their membrane fast enough, which limits cell size.
ProkaryoticEukaryotic
Nucleusno, DNA sits in a nucleoid regionyes
Membrane-bound organellesnoyes
DNAone circular chromosome, plus plasmidsseveral linear chromosomes
Ribosomessmaller (70S)larger (80S)
Typical size0.1–5 µm10–100 µm

Organelles

PartJob
Nucleusholds the DNA (eukaryotes only; prokaryotes have none)
Nucleolusinside the nucleus, makes ribosome parts
Mitochondriamake ATP by cellular respiration
Chloroplastsphotosynthesis (plants and algae)
Ribosomesbuild proteins
Rough / smooth ERprotein processing / lipid synthesis
Golgi apparatusmodifies, sorts and ships proteins
Lysosomesbreak down waste
Vacuolestores water and materials. Plant cells have one large central vacuole that keeps them firm.
Cytoskeletonprotein fibers that give shape and move things around the cell
Cell membranephospholipid bilayer, selectively permeable
Cell wallrigid outer layer: cellulose in plants, chitin in fungi, peptidoglycan in bacteria
  • Plant cells have a cell wall, chloroplasts and a large central vacuole. Animal cells have none of these, but they have centrioles.
  • Endosymbiotic theory: mitochondria and chloroplasts came from bacteria that were swallowed by an ancestral cell. They still have their own circular DNA, small ribosomes and a double membrane.
  • A protein made for export travels: ribosome on rough ER → Golgi → vesicle → cell membrane.

Molecules of life

Carbohydrates:
sugars and their chains, used for energy and structure. Glucose is a simple sugar. Starch (plants) and glycogen (animals) store energy. Cellulose builds plant cell walls.
Lipids:
fats, oils, phospholipids and steroids. They store energy long term and make up membranes.
Proteins:
chains of amino acids (20 kinds) joined by peptide bonds. Their folded shape decides their job.
Nucleic acids:
DNA and RNA, built from nucleotides. They store and use genetic information.
Enzyme:
a protein that speeds up a reaction by lowering its activation energy, without being used up. The substrate binds at the active site. Too much heat or the wrong pH denatures it (ruins its shape).
ATP:
the cell's energy currency. Breaking it into ADP and phosphate releases energy for cell work.

Membranes and transport

  • Fluid mosaic model: the membrane is a phospholipid bilayer, with water-loving heads facing out and water-fearing tails facing in, and proteins floating in it.
  • Small nonpolar molecules (O₂, CO₂) pass straight through. Ions and large polar molecules (glucose) need protein channels or carriers.
  • Passive transport needs no energy and moves substances down their concentration gradient: simple diffusion, facilitated diffusion (through proteins) and osmosis.
  • Osmosis: water moves across a membrane toward the side with more solute.
  • Active transport moves substances against their gradient using ATP. The sodium-potassium pump moves 3 Na⁺ out and 2 K⁺ in for each ATP.
  • Endocytosis brings large particles in by wrapping them in membrane. Exocytosis releases them out.
Solution outside the cellWater movesAnimal cellPlant cell
Hypertonic (more solute)out of the cellshrivelsmembrane pulls away from the wall (plasmolysis)
Isotonic (equal solute)no net movementnormallimp
Hypotonic (less solute)into the cellswells and can burstfirm (turgid), its healthy state

A red blood cell is placed in pure water. What happens?

  1. Pure water is hypotonic to the cell, which has more solute inside.
  2. Water flows in by osmosis, and an animal cell has no wall to stop it swelling.

It swells and bursts.

Cellular respiration and photosynthesis

Cellular respiration\(C_6H_{12}O_6+6O_2\rightarrow6CO_2+6H_2O+\text{ATP}\)
Photosynthesis\(6CO_2+6H_2O\xrightarrow{\text{light}}C_6H_{12}O_6+6O_2\)
Respiration stageWhereWhat it makes
Glycolysiscytoplasmglucose → 2 pyruvate, a net 2 ATP, and NADH. Needs no oxygen.
Krebs (citric acid) cyclemitochondrial matrixCO₂, 2 ATP, and many NADH and FADH₂
Electron transport chaininner mitochondrial membranemost of the ATP. Oxygen takes the electrons at the end and forms water.
  • Aerobic respiration yields about 30–32 ATP per glucose. Older textbooks say 36–38.
  • Fermentation runs without oxygen and makes only the 2 ATP from glycolysis. Muscles make lactic acid. Yeast makes ethanol and CO₂.
  • Photosynthesis has two stages. The light-dependent reactions in the thylakoid membranes split water, release O₂ and make ATP and NADPH. The Calvin cycle in the stroma uses them to fix CO₂ into sugar, with the enzyme rubisco.
  • The O₂ released by photosynthesis comes from water, not from CO₂.
  • Chlorophyll absorbs mostly red and blue light and reflects green, which is why leaves look green.

A muscle cell runs out of oxygen. How many ATP does it get from each glucose now?

  1. Without oxygen, the electron transport chain stops.
  2. Only glycolysis runs, followed by lactic acid fermentation.

2 ATP

The cell cycle and cell division

Interphase:
most of a cell's life. G1 (growth), S (DNA is copied), G2 (getting ready to divide).
Chromatid:
one of the two identical copies of a chromosome after S phase, joined at the centromere.
Homologous chromosomes:
a matching pair, one from each parent, carrying the same genes.
Diploid vs haploid:
diploid cells (2n) have both sets of chromosomes. Haploid cells (n), the gametes, have one set.
Cancer:
cells dividing out of control after the cell cycle's checkpoints fail.
  • Mitosis stages (PMAT): prophase (chromosomes condense, spindle forms), metaphase (chromosomes line up in the middle), anaphase (sister chromatids pulled apart), telophase (two nuclei form).
  • Cytokinesis then splits the cytoplasm: a pinching furrow in animal cells, a new cell plate in plant cells.
  • Meiosis creates variety three ways: crossing over in prophase I, independent assortment of chromosome pairs, and random fertilization.
  • Nondisjunction is when chromosomes fail to separate, giving a gamete an extra or missing chromosome. An extra chromosome 21 causes Down syndrome.
MitosisMeiosis
Purposegrowth, repair, asexual reproductionmaking gametes (sperm and eggs)
Divisions12
Cells made2 diploid4 haploid
Geneticallyidentical to the parentall different
Crossing overnoyes, in prophase I

A human body cell has 46 chromosomes. How many does a human egg cell have?

  1. Meiosis halves the chromosome number.

23

Humans have 23 chromosome pairs. How many different combinations can independent assortment alone put into one gamete?

  1. Each pair sends one of 2 chromosomes, independently.
  2. \(2^{23}\).

About 8.4 million

Genetics1

DNA, genes and chromosomes

Nucleotide:
the building block of DNA and RNA: a sugar, a phosphate and a nitrogen base.
DNA:
a double helix of two antiparallel strands. The sugar-phosphate backbone is on the outside, and the bases pair up in the middle.
Gene:
a stretch of DNA that codes for a product, usually a protein.
Chromosome:
one long DNA molecule wrapped around proteins called histones. The DNA-protein mix is chromatin.
Genome:
all the DNA in an organism.
  • DNA base pairing: A–T and G–C. In RNA, U replaces T.
  • A and G (purines) have two rings. C, T and U (pyrimidines) have one. A G–C pair has 3 hydrogen bonds and an A–T pair has 2, so DNA rich in G–C is harder to separate.
  • Chargaff's rule: in double-stranded DNA, A = T and G = C.
  • Humans have 23 pairs of chromosomes: 22 pairs of autosomes and one pair of sex chromosomes (usually XX in females, XY in males).
DNARNA
Sugardeoxyriboseribose
BasesA, T, G, CA, U, G, C
Strandstwousually one
Jobstores genetic informationmRNA carries the message, tRNA brings amino acids, rRNA forms ribosomes

DNA is 30% adenine. What percent is guanine?

  1. A pairs with T, so T = 30% and A + T = 60%.
  2. G + C = 40%, split equally.

20%

DNA replication

  • Replication is semi-conservative: each new double helix keeps one old strand. It happens in the S phase.
  • Helicase unzips the helix. Primase lays down a short RNA primer. DNA polymerase adds nucleotides, only in the 5′ to 3′ direction, and proofreads.
  • The leading strand is built in one piece. The lagging strand is built in short Okazaki fragments, which DNA ligase joins.

From gene to protein

  • Central dogma: DNA → (transcription) → mRNA → (translation) → protein.
  • Transcription: RNA polymerase reads the template strand and builds a matching mRNA. In eukaryotes it happens in the nucleus.
  • RNA processing (eukaryotes): the mRNA gets a cap and a poly-A tail, and its introns are cut out. The exons that remain are joined and leave the nucleus.
  • Translation: a ribosome reads the mRNA three bases (one codon) at a time. Each tRNA has an anticodon that matches a codon and carries one amino acid.
  • There are 64 codons. AUG is the start codon (methionine), and 3 codons are stops (UAA, UAG, UGA). The other 61 code for only 20 amino acids, so most amino acids have several codons.
  • Gene regulation: every body cell has the same DNA, but different cells switch on different genes. In bacteria, the lac operon turns on lactose-digesting genes only when lactose is around. In eukaryotes, transcription factors bind near genes to turn them on or off.

A DNA template strand reads 3′-TAC GGA-5′. What mRNA is made, and what does it code for?

  1. Pair each base, with U for A: TAC → AUG, GGA → CCU.
  2. AUG is methionine (start). CCU is proline.

5′-AUG CCU-3′, coding for methionine then proline

How many mRNA bases code for a protein 100 amino acids long, including the stop codon?

  1. \(100\times3=300\) bases for the amino acids.
  2. Add 3 for the stop codon.

303

Mutations

Substitution:
one base swapped for another. Silent if the amino acid stays the same, missense if it changes (sickle-cell disease), nonsense if it creates an early stop codon.
Frameshift:
an insertion or deletion of bases that isn't a multiple of 3. It shifts every codon after it, usually wrecking the protein.
Chromosome mutations:
a whole section deleted, duplicated, flipped (inversion) or moved to another chromosome (translocation).
Mutagen:
something that causes mutations, like UV light or certain chemicals.
  • Mutations are the original source of all genetic variation. Only those in gametes are passed on to offspring.

Inheritance

Allele:
a version of a gene. You get one allele of each gene from each parent.
Homozygous vs heterozygous:
two identical alleles (AA or aa) vs two different ones (Aa).
Dominant vs recessive:
a dominant allele shows with just one copy. A recessive allele shows only with two copies.
Genotype vs phenotype:
the genotype is the alleles (AA, Aa, aa). The phenotype is the observed trait.
Law of segregation:
the two alleles of a gene separate, so each gamete gets one.
Law of independent assortment:
genes on different chromosomes are inherited independently. Genes close together on the same chromosome (linked genes) tend to be inherited together.
Incomplete dominance:
the heterozygote is a blend, like red × white snapdragons giving pink.
Codominance:
both alleles show fully, like type AB blood.
Polygenic trait:
controlled by many genes, so it varies smoothly, like height.
Test cross:
crossing an individual that shows the dominant trait with a homozygous recessive one, to find out if it's AA or Aa.
  • Sex-linked genes sit on the X chromosome. X-linked recessive traits (hemophilia, red-green color blindness) show up more often in males, who have only one X.
  • A father passes his X to all his daughters and to none of his sons. A carrier mother passes the allele to half her children on average.
  • For independent events, multiply probabilities ("and"). For events that can't happen together, add them ("or").
Blood typePossible genotypes
A\(I^AI^A\) or \(I^Ai\)
B\(I^BI^B\) or \(I^Bi\)
AB\(I^AI^B\)
O\(ii\)
Monohybrid cross Aa × Aagenotypes 1 AA : 2 Aa : 1 aa, phenotypes 3 : 1
Dihybrid cross AaBb × AaBbphenotypes 9 : 3 : 3 : 1
Test cross Aa × aaphenotypes 1 : 1
Hardy–Weinberg (population allele frequencies)\(p+q=1,\quad p^2+2pq+q^2=1\)

AaBb × AaBb. What fraction of offspring are aabb?

  1. Chance of aa \(=\tfrac14\). Chance of bb \(=\tfrac14\).
  2. The genes sort independently, so multiply: \(\tfrac14\times\tfrac14\).

\(\tfrac{1}{16}\)

A mother carries hemophilia (\(X^HX^h\)) and the father doesn't have it (\(X^HY\)). What is the chance that a son has hemophilia?

  1. Every son gets his Y from his father and one X from his mother.
  2. Half the mother's eggs carry \(X^h\).

\(\tfrac12\) (and no daughters have it, though half are carriers)

Genetic technology

PCR:
the polymerase chain reaction copies a DNA segment many times. Each cycle heats the DNA to about 95 °C to separate it, cools it so primers attach, then warms it to about 72 °C so a heat-proof polymerase builds the copies. Each cycle doubles the DNA.
Gel electrophoresis:
sorts DNA fragments by size. DNA is negatively charged, so it moves toward the positive end, and smaller fragments travel farther.
Restriction enzyme:
cuts DNA at a specific sequence. DNA ligase glues pieces together.
Recombinant DNA:
DNA combined from different sources, like a human insulin gene put into a bacterial plasmid so bacteria make insulin.
CRISPR-Cas9:
a guide RNA leads the Cas9 enzyme to a matching DNA sequence, where it cuts so the gene can be edited.

PCR starts with one copy of a DNA segment. How many copies are there after 10 cycles?

  1. Each cycle doubles the count: \(2^{10}\).

1024

scienceChemistry

What atoms are made of, and how much reacts with what.

Atomic structure1

  • Atomic number \(Z\) = protons. Mass number \(A\) = protons + neutrons. A neutral atom has \(Z\) electrons.
  • Isotopes have the same \(Z\) but different numbers of neutrons. Ions have gained or lost electrons.
  • Electron configuration fills 1s, 2s, 2p, 3s, 3p, 4s, 3d… Valence electrons are those in the outermost shell.
  • Quantum numbers: \(n\) (shell), \(l\) (subshell), \(m_l\) (orbital), \(m_s\) (spin).
  • Periodic trends: atomic radius shrinks across a period and grows down a group. Ionization energy and electronegativity do the opposite. Fluorine is the most electronegative element.
Average atomic mass\(\sum(\text{abundance}\times\text{isotope mass})\)

How many neutrons and electrons are in \(^{35}\text{Cl}^-\)?

  1. Chlorine has \(Z=17\): neutrons \(=35-17=18\).
  2. The charge −1 means one extra electron: \(17+1=18\).

18 neutrons, 18 electrons

Stoichiometry1

Moles2\(n=\dfrac{m}{M},\quad N_A=6.022\times10^{23}\ \text{mol}^{-1}\)
Molarity and dilution\(c=\dfrac{n}{V},\quad c_1V_1=c_2V_2\)
Percent yield\(\dfrac{\text{actual}}{\text{theoretical}}\times100\%\)
Ideal gas at 0 °C and 1 atmabout 22.4 L per mole
  • Balance equations so each element has the same number of atoms on both sides. Then the coefficients give mole ratios.
  • The limiting reagent runs out first and sets the theoretical yield.
  • An empirical formula is the simplest whole-number ratio (CH₂O). A molecular formula is the actual count (C₆H₁₂O₆).

\(2H_2+O_2\rightarrow2H_2O\). With 4 g of H₂ and 16 g of O₂, how much water forms?

  1. H₂: \(4/2=2\) mol. O₂: \(16/32=0.5\) mol.
  2. 0.5 mol of O₂ needs only 1 mol of H₂, so O₂ is limiting.
  3. 0.5 mol of O₂ gives 1 mol of H₂O, which is 18 g.

18 g