Factorial


How many hours are there in a day? \(4!\)

The factorial of a non-negative integer is the product of all positive integers less than or equal to that integer. Intuitively, \(n!\) is the number of unique sequences that can be made from \(n\) elements.

For the factorial of an integer \(n\), denoted \(n!\): $$n! = n \times (n-1) \times (n-2) \times ... \times 3 \times 2 \times 1$$ Also, any factorial can be rewritten in terms of a smaller factorial: $$n! = n \times (n-1)!$$

By convention, \(0! = 1.\) In other words, there is only \(1\) way to arrange \(0\) things, which is a fun way to think about it.

Contents

Recursive definition


Through recursion, the computation of any factorial can be whittled down to a single base case. Here's the recursive definition:

The factorial function \(f(n) = n!\) can be recursively defined for \(n \geq 1\): $$f(0) = 1$$ $$f(n) = n \times f(n-1)$$
Logic & Proofs
IntegerRational numberInequalityReal numberTheoremProofStatementProof by exhaustionUniversal generalizationCounterexampleExistence proofExistential instantiationAxiomLogicTruthPropositionCompound propositionLogical operationLogical equivalenceTautologyContradictionLogic lawPredicateDomainQuantifierArgumentRule of inferenceLogical proofDirect proofProof by contrapositiveIrrational numberProof by contradictionProof by casesSummationDisjunctive normal form
Set Theory
SetElementEmpty setUniversal setSubsetPower setCartesian productStringBinary stringEmpty stringSet operationSet identitySet proof
Functions
FunctionFloor functionCeiling functionInverse function
Algorithms
AlgorithmPseudocodeCommandAsymptotic notationTime complexityAtomic operationBrute-force algorithm
Relations
RelationReflexive relationSymmetric relationTransitive relationRelation compositionEquivalence relationEquivalence class
Number Theory
Integer divisionLinear combinationDivision algorithmModular arithmeticPrime factorizationGreatest common divisorLeast common multiplePrimality testFactoring algorithmEuclid's theoremPrime number theoremEuclidean algorithm
Induction
Proof by inductionFibonacci sequenceProof by strong inductionWell-ordering principleSequenceFactorialRecursive definition
Combinatorics
Rule of productRule of sumBijection rulePermutationCombinationComplement ruleExperimentOutcomeSample spaceEventProbabilityProbability distributionUniform distributionMultisetSixfold wayInclusion-exclusion principlePigeonhole principle
Graph Theory
GraphWalkSubgraphRegular graphComplete graphEmpty graphCycle graphHypercube graphBipartite graphComponentEulerian circuitEulerian trailHamiltonian cycleHamiltonian pathTreeHuffman treeSubstringForestPath graphStarSpanning treeWeighted graphMinimum spanning treeGreedy algorithmPrim's algorithm
Recursion
RecursionRecursive algorithmCorrectness proofDivide-and-conquer algorithmSorting algorithmMerge sort