Everything on the site.

Big-O notationAlgorithms · Count the steps in real loops, then compare n, n log n, n² and 2ⁿ on a live chart.RecursionAlgorithms · Watch frames push and pop on the call stack for factorial and Fibonacci.BFS vs DFSAlgorithms · A queue against a stack: draw a graph and see which order each search visits it in.Sorting algorithmsAlgorithms · Seven sorts on the same input, with comparison, swap and write counts side by side.Binary searchAlgorithms · Halve the range, probe the middle, repeat: with lo, mid and hi drawn on the array.Sets, relations and functionsDiscrete maths · Shade any set expression on a Venn diagram and test a relation for its properties.Proof by inductionDiscrete maths · Four worked proofs revealed one step at a time, and a broken one to diagnose.CombinatoricsDiscrete maths · An exact nPr and nCr calculator, and a Pascal’s triangle that shows its own addition rule.Boolean algebraDiscrete maths · The laws, De Morgan, and normal forms, with a truth-table generator built in.Finite-state machinesTheory · Build a DFA in a table, see it drawn, and run strings through it one symbol at a time.Domain theoryTheory · Why recursion needs least fixed points, and how CPOs, Scott continuity and powerdomains supply them.Truth table generatorTools · Expression in, truth table out: with DNF, CNF, a minimal form and LaTeX.Graph traversal visualiserTools · Draw a graph, then animate BFS, DFS and Dijkstra with the frontier shown.Recursion tree visualiserTools · Paste a recursive function or a recurrence and see its call tree and call count.Gradient descentML maths · Drag the starting point, set the learning rate, and watch it converge or blow up.Vectors and embeddingsML maths · Bend the plane with a 2×2 matrix and measure how close toy word vectors are.Softmax and cross-entropyML maths · Edit the logits and watch the probabilities, the loss and the gradient update live.Attention mechanismML maths · Q, K and V for three tokens, a live score heatmap, and the weighted sum of values.Formatting a CS paper in LaTeXLaTeX · Page limits, \documentclass, front matter, theorem environments and the bibliography.Camera-ready checklistLaTeX · Fonts embedded, PDF/A, copyright form, source bundle, and why final versions get rejected.LaTeX templatesLaTeX · Where the official classes live, plus a minimal article template you can copy.Boolean algebra calculatorTools · A Boolean expression simplifier that names the law used at every step.K-map solverTools · Fill in a Karnaugh map and see the groups, the minimal SOP and POS, and the essential terms.Logic gate simulatorTools · Wire up gates, flip the switches, and get the truth table and expression of your circuit.Regex to NFA converterTools · Type a regular expression and watch Thompson’s construction build its NFA, fragment by fragment.NFA to DFA converterTools · Enter an NFA or a regex and step through the subset construction, then minimise the DFA.DFA simulatorTools · Edit a DFA, run strings through it step by step, batch-test them and share the machine as a link.Regular expressions to automataTheory · Regex to NFA to DFA to minimal DFA, worked through on one example with every set shown.The halting problemTheory · Why no program can tell whether every program halts, with the paradox program played out.Pigeonhole principleDiscrete maths · n pigeons, k holes: why some hole gets ⌈n/k⌉, and the surprising things that follows from it.Dijkstra’s algorithmAlgorithms · Shortest paths with a priority queue: a worked table, a proof, and a graph you can redraw.Hash functionsAlgorithms · Keys in, buckets out: hash a word four ways, then watch chaining and probing handle collisions.Sorting algorithm visualizerTools · Up to seven sorts race on the same data, then step through any one of them line by line.LaTeX table generatorTools · Type or paste a table, merge cells, pick booktabs, and copy clean tabular code.Combination calculatorTools · Exact nCr with the cancelling shown, combinations with repetition, and a full list for small n.Permutation calculatorTools · nPr, nʳ, anagrams like MISSISSIPPI and round-table seatings, with exact working.AlgorithmsSection · Step-through visualisations of sorting, searching, recursion, graph traversal, Dijkstra’s algorithm, hash functions and Big-O growth, with pseudocode that follows along.Discrete mathsSection · Sets, relations and functions, proof by induction, counting, the pigeonhole principle and Boolean algebra, explained with worked examples and interactive checkers.TheorySection · Finite-state machines, regular expressions and automata, the halting problem, and the mathematical semantics of programming languages, explained from first principles.ML mathsSection · Gradient descent, vectors and embeddings, softmax and cross-entropy, and attention, each with a formula, a worked numeric example and a live version.ToolsSection · Free browser tools: truth tables, Boolean simplification, K-maps, logic gates, nCr and nPr, regex to NFA to DFA, sorting and graph visualisers, and LaTeX tables.LaTeXSection · How to format a CS conference or workshop paper in LaTeX, a camera-ready checklist, and a minimal template you can adapt.
Free tool

Boolean algebra calculator: simplify expressions step by step

Type a Boolean expression and this calculator simplifies it one law at a time, from De Morgan and distribution through absorption and the consensus theorem, until it reaches the simplest sum of products. It also gives the simplest product of sums, and checks every step against the full truth table.

Interactive: Step-by-step Boolean expression simplifierUpdated

Boolean algebra calculator

Write AB + A'C in textbook style, or use words and symbols: and & ∧, or | ∨,not ! ¬ or a postfix ', xor ⊕, ->, <->, nand, nor, 0, 1. Up to 8 variables.

How to use the simplifier

Enter an expression in whichever notation your course or textbook uses. In digital-logic style, juxtaposition means AND, + means OR and a prime means NOT, so AB + A'C is (A∧B)∨(¬A∧C)(A \land B) \lor (\lnot A \land C). In logic style, write A and B or not A and C, or paste symbols such as ∧, ∨ and ¬. Implication (->), the biconditional (<->), XOR, NAND and NOR are accepted too, and are rewritten away in the first steps.

With “Single-letter variables” ticked, AB is read as A AND B, which is what most circuit textbooks mean. Untick it if your variables have longer names, such as rain and wet; then AB is one variable called AB. Names with digits, like x1 and x2, work either way.

The results show the minimal DNF (fewest product terms, then fewest literals) and the minimal CNF (the same for sums), written both in textbook notation (AB′ + C) and in logic notation. Below them is the full derivation. Each step shows the whole expression after one law has been applied, the name of the law, and the instance of it that was used. The button under the steps copies the derivation as a LaTeX align* block, with each law as a right-hand annotation, ready for homework or lecture notes. The address bar keeps your expression, so you can bookmark or share a derivation.

The laws it uses

Every step is one of the standard identities below. Each has a dual: swap AND with OR and 0 with 1. Juxtaposition (ABAB) means AND in the table.

LawAND formOR form (dual)
IdentityA∧1=AA \land 1 = AA∨0=AA \lor 0 = A
Annulment (domination)A∧0=0A \land 0 = 0A∨1=1A \lor 1 = 1
IdempotenceA∧A=AA \land A = AA∨A=AA \lor A = A
ComplementA∧¬A=0A \land \lnot A = 0A∨¬A=1A \lor \lnot A = 1
Double negation¬¬A=A\lnot\lnot A = A—
De Morgan¬(A∧B)=¬A∨¬B\lnot(A \land B) = \lnot A \lor \lnot B¬(A∨B)=¬A∧¬B\lnot(A \lor B) = \lnot A \land \lnot B
DistributivityA∧(B∨C)=AB∨ACA \land (B \lor C) = AB \lor ACA∨BC=(A∨B)(A∨C)A \lor BC = (A \lor B)(A \lor C)
AbsorptionA∨AB=AA \lor AB = AA(A∨B)=AA(A \lor B) = A
RedundancyA∨¬AB=A∨BA \lor \lnot A B = A \lor BA(¬A∨B)=ABA(\lnot A \lor B) = AB
CombiningAB∨A¬B=AAB \lor A\lnot B = A(A∨B)(A∨¬B)=A(A \lor B)(A \lor \lnot B) = A
ConsensusAB∨¬AC∨BC=AB∨¬ACAB \lor \lnot A C \lor BC = AB \lor \lnot A C(A∨B)(¬A∨C)(B∨C)=(A∨B)(¬A∨C)(A \lor B)(\lnot A \lor C)(B \lor C) = (A \lor B)(\lnot A \lor C)

The last three are derived laws, shortcuts for a few basic steps. Combining is distributivity followed by complement and identity: AB∨A¬B=A(B∨¬B)=A⋅1=AAB \lor A\lnot B = A(B \lor \lnot B) = A \cdot 1 = A. The consensus theorem says that in AB∨¬ACAB \lor \lnot A C, the term BCBC is redundant: whenever BB and CC are both 1, one of the other two terms is already 1, whatever AA is. The redundancy law is the consensus theorem when one term is a single literal.

How the calculator simplifies

Simplifying by hand is a search: at each point several laws apply, and a bad choice can make the expression longer. The calculator follows a fixed strategy that always reaches the true minimum.

  1. Remove the extra operators. Constants are folded away, then A→BA \to B becomes ¬A∨B\lnot A \lor B, A↔BA \leftrightarrow B becomes AB∨¬A¬BAB \lor \lnot A \lnot B, A⊕BA \oplus B becomes A¬B∨¬ABA\lnot B \lor \lnot A B, and NAND and NOR become negated AND and OR.
  2. Push negations inwards. De Morgan’s laws and double negation are applied until NOT only appears directly on variables. This is called negation normal form.
  3. Multiply out. AND is distributed over OR until the expression is a sum of products. Products that contain a variable and its negation are 0 and are dropped, and repeated literals are merged.
  4. Tidy the sum. Repeated products are removed (idempotence), products that contain another product are absorbed, and pairs of products that differ in one variable are combined.
  5. Reach every prime implicant. Following Blake’s method, the consensus of two products is added whenever it is not already covered, and absorption then removes whatever it covers. At the end of this stage the sum is exactly the set of prime implicants, the products that cannot be shortened.
  6. Delete redundant products. Prime implicants that the rest already cover are removed one by one, using the consensus theorem where it applies, until the remaining products are the minimal cover that the Quine–McCluskey method picks.

After each step the calculator compares the new expression with the previous one on every row of the truth table, which is the “every step checked” badge. Up to 6 variables you get the whole derivation; with 7 or 8 variables, or when multiplying out would produce more than 96 products, the derivation stops after the negation-normal-form steps and finishes with a single minimisation step, because the algebra would run to hundreds of lines.

Worked example: (A+B)(A‾+C)(A + B)(\overline{A} + C)

This function is 1 on 4 of the 8 rows. The calculator takes 4 steps:

  1. Distributivity. A∧¬A∨A∧C∨B∧¬A∨B∧CA \land \lnot A \lor A \land C \lor B \land \lnot A \lor B \land C Multiply out: A ∧ (B ∨ C) = (A ∧ B) ∨ (A ∧ C), until the expression is an OR of ANDs (a sum of products).
  2. Commutativity. A∧¬A∨A∧C∨¬A∧B∨B∧CA \land \lnot A \lor A \land C \lor \lnot A \land B \lor B \land C Reorder the literals in each product: A ∧ B = B ∧ A.
  3. Complement and identity. A∧C∨¬A∧B∨B∧CA \land C \lor \lnot A \land B \lor B \land C A ∧ ¬A = 0, so 1 product containing a variable and its negation is 0, and X ∨ 0 = X removes it.
  4. Consensus theorem (removing a term). A∧C∨¬A∧BA \land C \lor \lnot A \land B XY ∨ ¬XZ ∨ YZ = XY ∨ ¬XZ: B ∧ C is the consensus of A ∧ C and ¬A ∧ B, so it can go.

The answer, AC∨A‾BAC \lor \overline{A}B, reads naturally: if AA is 1 the output follows CC, and if AA is 0 it follows BB. It is a two-way multiplexer with AA as the select line. The BCBC term that multiplying out produced is the classic consensus term, and spotting it is the step most hand derivations miss.

Worked example: negations first

For ¬(A∧(B∨¬C))\lnot(A \land (B \lor \lnot C)) the work is all De Morgan:

  1. De Morgan’s laws. ¬A∨¬(B∨¬C)\lnot A \lor \lnot (B \lor \lnot C)
  2. De Morgan’s laws. ¬A∨¬B∧¬¬C\lnot A \lor \lnot B \land \lnot \lnot C
  3. Double negation. ¬A∨¬B∧C\lnot A \lor \lnot B \land C

A common slip is to negate only the first operand, writing ¬A∧(B∨¬C)\lnot A \land (B \lor \lnot C). De Morgan flips the operator as well as negating both sides.

Common mistakes when simplifying by hand

  • Treating OR like addition. A+A=AA + A = A, not 2A2A, and 1+1=11 + 1 = 1. There is no subtraction or division in Boolean algebra, so you cannot “cancel” a term from both sides of an equation.
  • Forgetting the second distributive law. A+BC=(A+B)(A+C)A + BC = (A + B)(A + C) is true in Boolean algebra though false for numbers. It is the quickest way to convert to a product of sums.
  • Stopping at a local minimum. AB+A‾C+BCAB + \overline{A}C + BC has no pair of terms that combine, so it looks finished, but BCBC is redundant by consensus. The calculator always checks for consensus terms.
  • Assuming the answer is unique. Some functions have more than one minimal form. For example, A‾B+B‾C+AC‾\overline{A}B + \overline{B}C + A\overline{C} and AB‾+BC‾+A‾CA\overline{B} + B\overline{C} + \overline{A}C are the same function, and both are minimal. If your answer differs from the calculator’s, check that it has the same number of terms and literals, then paste both into the equivalence checker on the truth table generator.
Algebra, maps or Quine–McCluskey? Algebraic simplification shows why an expression simplifies, which is what exams usually ask for. For up to four or five variables, a Karnaugh map is faster to do by hand and makes the groups visible. For more variables, use a tabular method like Quine–McCluskey. All three reach the same minimal forms.

Minimal SOP and POS

A sum of products is what a two-level AND–OR circuit computes: one AND gate per product, one OR gate to combine them. Minimising the number of products minimises the gates, and minimising literals minimises the gate inputs. The product of sums is the OR–AND equivalent. The calculator finds it by minimising the complement of the function, which is 1 exactly where the original is 0, and applying De Morgan to the result. Neither form is always smaller: the parity function A⊕B⊕CA \oplus B \oplus C needs four products and four sums, while A(B+C)A(B + C) uses three literals as a product of sums but four as the sum of products AB+ACAB + AC.

To check an answer row by row, use the truth table generator. To see the same simplification as rectangles on a grid, use the K-map solver. The Boolean algebra explainer covers the theory, and the logic gate simulator lets you build the resulting circuit.

References

  1. E. J. McCluskey, “Minimization of Boolean functions”, Bell System Technical Journal 35(6), 1956. doi:10.1002/j.1538-7305.1956.tb03835.x
  2. A. Blake, Canonical Expressions in Boolean Algebra, PhD dissertation, University of Chicago, 1937. The origin of the consensus method used in step 5.
  3. M. M. Mano and M. D. Ciletti, Digital Design, 6th ed., Pearson, 2018. Chapters 2 and 3.
  4. “Consensus theorem”, Wikipedia.