Index

Feb 20, 2019
Using Anki for mathematics
Resource

Since mid-2017, I have used Anki to help me learn and remember stuff. Anki is a popular open-source implementation of spaced repetition, which is a timing protocol for flashcard software that turns the act of committing something to long-term memory into a conscious decision. Gwern Branwen, Nicky Case and Michael Nielsen have all written excellent introductions to the topic. If you are yet to seriously try it, do1. I can’t recommend it enough.

The purpose of this post is to share the custom note types I use for adding mathematical definitions and theorems to Anki, because they are a marked improvement over the default. Beyond this point, I’ll assume that you are familiar with the software.

It may have been fixed by now, but for a long time Anki’s inbuilt cloze functionality tended to break when combined with LaTeX (via mathjax), inserting random line breaks and preventing the symbols from being parsed. This was the impetus for creating note types that automatically and robustly generated much cleaner cloze cards.

The fronts of cards are marked ░░░░ in the upper right corner. Backs: ▓▓▓▓.

All cards use Ethan Schoonover’s exacting Solarized colour scheme. On non-math cards, I also use Sans Forgetica, a font that promotes memory by being appropriately difficult to read.

#### Notes for Definitions

These notes have eight fields: 1 object descriptor, 5 properties (all optional), 1 context area (optional), 1 subcontext area (optional), and 1 object name. The fields position themselves onto cards like so. (If you’re on a small screen, horizontal scrolling/swiping may be required.)

░░░░
Context
└─SubContext
name Definition?
▓▓▓▓
descriptor
:
property #1
property #2
property #3
property #4
property #5

The table structure means that it's simple to generate cloze cards. The note type also works fine if the optional fields are left out, and will only generate the relevant cards. For instance, here are all the cards that are generated for the definition of a $$\sigma$$-algebra, which only has three properties and doesn't use the subcontext field.

░░░░
Probability$$\sigma$$-algebra Definition?
▓▓▓▓
set $$\mathcal{F}$$ of subsets of $$\Omega$$
:
$$\Omega\in\mathcal{F}$$
$$A\in\mathcal{F}\implies A^c\in\mathcal{F}$$
$$\mathcal{F}$$ closed under countable union

░░░░
set $$\mathcal{F}$$ of subsets of $$\Omega$$
:
$$\Omega\in\mathcal{F}$$
$$A\in\mathcal{F}\implies A^c\in\mathcal{F}$$
$$\mathcal{F}$$ closed under countable union
Definition of?
▓▓▓▓
Probability $$\sigma$$-algebra
░░░░
set $$\mathcal{F}$$ of subsets of $$\Omega$$
:
$$\Omega\in\mathcal{F}$$
$$A\in\mathcal{F}\implies A^c\in\mathcal{F}$$
$$\mathcal{F}$$ closed under countable union

Probability$$\sigma$$-algebra

▓▓▓▓
set $$\mathcal{F}$$ of subsets of $$\Omega$$
:
$$\Omega\in\mathcal{F}$$
$$A\in\mathcal{F}\implies A^c\in\mathcal{F}$$
$$\mathcal{F}$$ closed under countable union

Probability$$\sigma$$-algebra

░░░░
set $$\mathcal{F}$$ of subsets of $$\Omega$$
:
$$\Omega\in\mathcal{F}$$
$$A\in\mathcal{F}\implies A^c\in\mathcal{F}$$
$$\mathcal{F}$$ closed under countable union

Probability$$\sigma$$-algebra

▓▓▓▓
set $$\mathcal{F}$$ of subsets of $$\Omega$$
:
$$\Omega\in\mathcal{F}$$
$$A\in\mathcal{F}\implies A^c\in\mathcal{F}$$
$$\mathcal{F}$$ closed under countable union

Probability$$\sigma$$-algebra

░░░░
set $$\mathcal{F}$$ of subsets of $$\Omega$$
:
$$\Omega\in\mathcal{F}$$
$$A\in\mathcal{F}\implies A^c\in\mathcal{F}$$
$$\mathcal{F}$$ closed under countable union

Probability$$\sigma$$-algebra

▓▓▓▓
set $$\mathcal{F}$$ of subsets of $$\Omega$$
:
$$\Omega\in\mathcal{F}$$
$$A\in\mathcal{F}\implies A^c\in\mathcal{F}$$
$$\mathcal{F}$$ closed under countable union

Probability$$\sigma$$-algebra

#### Notes for Theorems

Most theorems fit naturally into one of two kinds. The first is 'implication only', where there is a set of conditions which, when collectively satisfied, imply a set of conclusions. My note type for this kind of theorem has eleven fields: 4 theorem conditions, 4 theorem conclusions, 1 theorem name, 1 context area and 1 subcontext area. All fields are optional. Here is how they position themselves onto cards.

░░░░
Context
└─SubContext
name Statement?
▓▓▓▓
condition #1
condition #2
condition #3
condition #4
conclusion #1
conclusion #2
conclusion #3
conclusion #4

Hopefully by this point the visual grammar of the system is making sense. As an example, here are the cards that would be generated by a note of this type for the delta method.

░░░░
Random Variables
└─Convergence
delta methodStatement?
▓▓▓▓
$$\lim_{n\to\infty}a_n=\infty$$
$$a_n(X_n-\mu)\xrightarrow{d}Y$$
$$g$$ differentiable at $$\mu$$
$$a_n\left(g(X_n)-g(\mu)\right)\xrightarrow{d}g'(\mu)Y$$

░░░░
$$\lim_{n\to\infty}a_n=\infty$$
$$a_n(X_n-\mu)\xrightarrow{d}Y$$
$$g$$ differentiable at $$\mu$$
$$a_n\left(g(X_n)-g(\mu)\right)\xrightarrow{d}g'(\mu)Y$$
Statement of?
▓▓▓▓
Random Variables
└─Convergence
delta method
░░░░
$$\lim_{n\to\infty}a_n=\infty$$
$$a_n(X_n-\mu)\xrightarrow{d}Y$$
$$g$$ differentiable at $$\mu$$
$$a_n\left(g(X_n)-g(\mu)\right)\xrightarrow{d}g'(\mu)Y$$

Random Variables
└─Convergence
delta method

▓▓▓▓
$$\lim_{n\to\infty}a_n=\infty$$
$$a_n(X_n-\mu)\xrightarrow{d}Y$$
$$g$$ differentiable at $$\mu$$
$$a_n\left(g(X_n)-g(\mu)\right)\xrightarrow{d}g'(\mu)Y$$

Random Variables
└─Convergence
delta method

░░░░
$$\lim_{n\to\infty}a_n=\infty$$
$$a_n(X_n-\mu)\xrightarrow{d}Y$$
$$g$$ differentiable at $$\mu$$
$$a_n\left(g(X_n)-g(\mu)\right)\xrightarrow{d}g'(\mu)Y$$

Random Variables
└─Convergence
delta method

▓▓▓▓
$$\lim_{n\to\infty}a_n=\infty$$
$$a_n(X_n-\mu)\xrightarrow{d}Y$$
$$g$$ differentiable at $$\mu$$
$$a_n\left(g(X_n)-g(\mu)\right)\xrightarrow{d}g'(\mu)Y$$

Random Variables
└─Convergence
delta method

░░░░
$$\lim_{n\to\infty}a_n=\infty$$
$$a_n(X_n-\mu)\xrightarrow{d}Y$$
$$g$$ differentiable at $$\mu$$
$$a_n\left(g(X_n)-g(\mu)\right)\xrightarrow{d}g'(\mu)Y$$

Random Variables
└─Convergence
delta method

▓▓▓▓
$$\lim_{n\to\infty}a_n=\infty$$
$$a_n(X_n-\mu)\xrightarrow{d}Y$$
$$g$$ differentiable at $$\mu$$
$$a_n\left(g(X_n)-g(\mu)\right)\xrightarrow{d}g'(\mu)Y$$

Random Variables
└─Convergence
delta method

░░░░
$$\lim_{n\to\infty}a_n=\infty$$
$$a_n(X_n-\mu)\xrightarrow{d}Y$$
$$g$$ differentiable at $$\mu$$
$$a_n\left(g(X_n)-g(\mu)\right)\xrightarrow{d}g'(\mu)Y$$

Random Variables
└─Convergence
delta method

▓▓▓▓
$$\lim_{n\to\infty}a_n=\infty$$
$$a_n(X_n-\mu)\xrightarrow{d}Y$$
$$g$$ differentiable at $$\mu$$
$$a_n\left(g(X_n)-g(\mu)\right)\xrightarrow{d}g'(\mu)Y$$

Random Variables
└─Convergence
delta method

The second kind of theorem is 'implication and equivalency', where there is a set of conditions which, if satisfied, imply that two or more other statements are equivalent in some (deliberately vague) sense . My note type for this kind of theorem is almost identical to the previous, but I use blue (rather than green) for the equivalent statements to denote the different relationship between them. The distinction is subtle, but doesn't take long to internalise. Here is the basic structure.

░░░░
Context
└─SubContext
name Statement?
▓▓▓▓
condition #1
condition #2
condition #3
condition #4
equivalent statement #1
equivalent statement #2
equivalent statement #3
equivalent statement #4
equivalent statement #5

This note type has room for five (rather than four) equivalent statements, simply because I needed to fit the portmanteau theorem . I've seen a few Anki best practice guides that warn against getting too elaborate with different note types, and particularly against having too many fields on a given note type. That is a valid concern. But while these note types have a large-ish number of fields, I save sufficient time from not having to manually specify cloze boundaries that I think they are justified. The self-imposed structure also helps clarify my mental models, and the visual consistency makes doing reviews much more enjoyable.

Instead of a full set, here are two example cards for different theorems of this kind. Note that the first theorem has no name or conditions, and the card happily omits them.

░░░░
$$\mathsf{rank}(X)$$
$$\mathsf{rank}(X^T)$$
$$\mathsf{rank}(X^TX)$$

▓▓▓▓
$$\mathsf{rank}(X)$$
$$\mathsf{rank}(X^T)$$
$$\mathsf{rank}(X^TX)$$

░░░░
$$\{\mu_n\}_{n\geq 1}$$, $$\mu$$ sub-probability measures on $$(\mathbb{R},\mathscr{B}(\mathbb{R}))$$
$$\mu_n\xrightarrow{v}\mu$$
$$\int f\ d\mu_n\to \int f\ d\mu\ \forall\ f\in\mathscr{C}_K(\mathbb{R})$$

Probability Measures
└─Convergence
Helly-Bray theorem (1)

▓▓▓▓
$$\{\mu_n\}_{n\geq 1}$$, $$\mu$$ sub-probability measures on $$(\mathbb{R},\mathscr{B}(\mathbb{R}))$$
$$\mu_n\xrightarrow{v}\mu$$
$$\int f\ d\mu_n\to \int f\ d\mu\ \forall\ f\in\mathscr{C}_K(\mathbb{R})$$

Probability Measures
└─Convergence
Helly-Bray theorem (1)

The great thing about the concept of equality is that it can be used to mean lots of different things. In the above two examples, it is used first for exact numerical equality, and then for logical equivalence.

A small sample deck with examples of each of the above note types (plus a few more with a similar flavour) can be found here.