computational problems

111
Computational problems From Wikipedia, the free encyclopedia

Upload: man

Post on 12-Jan-2016

40 views

Category:

Documents


14 download

DESCRIPTION

1. From Wikipedia, the free encyclopedia2. Lexicographical order

TRANSCRIPT

Page 1: Computational Problems

Computational problemsFrom Wikipedia, the free encyclopedia

Page 2: Computational Problems

Contents

1 AI-complete 11.1 History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 AI-complete problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.2.1 Machine translation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.3 Software brittleness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.4 Formalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

1.4.1 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.5 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.6 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2 Art gallery problem 42.1 Two dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.1.1 Chvátal’s art gallery theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42.1.2 Fisk’s short proof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42.1.3 Generalizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.1.4 Computational complexity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.2 Three dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.3 Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.4 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

3 Circuit satisfiability problem 103.1 Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103.2 The Tseitin transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103.3 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103.4 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

4 Computational problem 124.1 Types of computational problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124.2 Promise problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134.3 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

5 Computing the permanent 145.1 Definition and naive algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

i

Page 3: Computational Problems

ii CONTENTS

5.2 Ryser formula . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145.3 Balasubramanian-Bax/Franklin-Glynn formula . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155.4 Special cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

5.4.1 Planar and K₃,₃-free . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155.4.2 Computation modulo a number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

5.5 Approximate computation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165.6 Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165.7 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

6 Counting problem (complexity) 186.1 Counting complexity class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186.2 External links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

7 Covering problems 197.1 General LP formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197.2 Other uses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197.3 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197.4 Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197.5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207.6 External links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

8 Decision problem 218.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218.2 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218.3 Decidability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228.4 Complete problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238.5 Equivalence with function problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238.6 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238.7 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

9 Dining philosophers problem 259.1 Problem statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

9.1.1 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259.2 Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

9.2.1 Resource hierarchy solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279.2.2 Arbitrator solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279.2.3 Chandy/Misra solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

9.3 Source code example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289.4 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289.5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289.6 External links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

10 Dutch national flag problem 30

Page 4: Computational Problems

CONTENTS iii

10.1 The array case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3110.1.1 Pseudocode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

10.2 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3110.3 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3110.4 External links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

11 Function problem 3211.1 Formal definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3211.2 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3211.3 Relationship to other complexity classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3211.4 Self-reducibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3311.5 Reductions and complete problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3311.6 Total function problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3311.7 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3311.8 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

12 Gap reduction 3412.1 c-gap problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3412.2 Gap-producing reduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3412.3 Gap-preserving reduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3512.4 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

12.4.1 Max E3SAT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3512.4.2 Label Cover . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

12.5 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3612.6 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

13 Josephus problem 3713.1 History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3713.2 Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

13.2.1 k=2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3813.2.2 The general case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

13.3 Variants and generalizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3913.3.1 Extended Josephus problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

13.4 Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3913.5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3913.6 External links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

14 Linear search problem 4014.1 The problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4014.2 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4014.3 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

15 List of PPAD-complete problems 42

Page 5: Computational Problems

iv CONTENTS

15.1 Fixed Point Theorems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4215.2 Topology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4215.3 Game Theory and Nash Equilibrium . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4215.4 Economics and Market Equilibria . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4215.5 Scarf’s Lemma and Fractional Stability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4315.6 Miscellaneous . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4315.7 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4315.8 External links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

16 n-body problem 4416.1 History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4416.2 General formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4516.3 Special cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

16.3.1 Two-body problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4616.3.2 Three-body problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4816.3.3 Planetary problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5116.3.4 Central configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5116.3.5 n-body choreography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

16.4 Analytic approaches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5116.4.1 Power series solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5216.4.2 A generalized Sundman global solution . . . . . . . . . . . . . . . . . . . . . . . . . . . 5216.4.3 Singularities of the n-body problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

16.5 Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5216.5.1 Few bodies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5216.5.2 Many bodies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5316.5.3 Strong gravitation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

16.6 Other n-body problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5416.7 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5416.8 Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5416.9 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5616.10Further reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5816.11External links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

17 Optimization problem 6017.1 Continuous optimization problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6017.2 Combinatorial optimization problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

17.2.1 NP optimization problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6117.3 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6217.4 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

18 Promise problem 6318.1 Formal definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

Page 6: Computational Problems

CONTENTS v

18.2 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6318.3 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6318.4 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

18.4.1 Surveys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

19 Search problem 6519.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6519.2 Objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6619.3 Search method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6619.4 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6619.5 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

20 Set splitting problem 6720.1 Variants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6720.2 Connection to Other Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6720.3 Approximability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6720.4 Fixed-Parameter Tractability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6720.5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

21 Sharp-P-completeness of 01-permanent 6921.1 Significance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6921.2 Ben-Dor and Halevi’s proof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

21.2.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7021.2.2 Constructing the integer graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7021.2.3 01-Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

21.3 Aaronson’s proof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7421.4 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74

22 Sharp-SAT 7622.1 Intractable special cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7622.2 Tractable special cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76

23 Sum of radicals 7723.1 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7723.2 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

24 Tutte polynomial 7924.1 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

24.1.1 Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8124.1.2 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

24.2 History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8124.3 Specialisations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82

24.3.1 Chromatic polynomial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8224.3.2 Jones polynomial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83

Page 7: Computational Problems

vi CONTENTS

24.3.3 Individual points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8324.3.4 Potts and Ising models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8424.3.5 Flow polynomial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8524.3.6 Reliability polynomial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8624.3.7 Dichromatic polynomial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

24.4 Related polynomials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8724.4.1 Martin polynomial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

24.5 Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8824.5.1 Deletion–contraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8824.5.2 Gaussian elimination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8924.5.3 Markov chain Monte Carlo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

24.6 Computational complexity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8924.6.1 Exact computation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9024.6.2 Approximation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91

24.7 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9124.8 Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9124.9 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9224.10External links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

25 Unknotting problem 9425.1 Computational complexity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9525.2 Unknotting algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9525.3 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9625.4 Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9625.5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9725.6 External links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

26 Word problem (mathematics) 9826.1 Background and motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9826.2 The word problem in combinatorial calculus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9826.3 The word problem in universal algebra . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9926.4 Example: A term rewriting system to decide the word problem in the free group . . . . . . . . . . . 9926.5 See also . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9926.6 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10026.7 Text and image sources, contributors, and licenses . . . . . . . . . . . . . . . . . . . . . . . . . . 101

26.7.1 Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10126.7.2 Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10326.7.3 Content license . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104

Page 8: Computational Problems

Chapter 1

AI-complete

In the field of artificial intelligence, the most difficult problems are informally known as AI-complete or AI-hard,implying that the difficulty of these computational problems is equivalent to that of solving the central artificial intel-ligence problem—making computers as intelligent as people, or strong AI.[1] To call a problem AI-complete reflectsan attitude that it would not be solved by a simple specific algorithm.AI-complete problems are hypothesised to include computer vision, natural language understanding, and dealing withunexpected circumstances while solving any real world problem.[2]

Currently, AI-complete problems cannot be solved with modern computer technology alone, but would also requirehuman computation. This property can be useful, for instance to test for the presence of humans as with CAPTCHAs,and for computer security to circumvent brute-force attacks.[3][4]

1.1 History

The term was coined by Fanya Montalvo by analogy with NP-complete and NP-hard in complexity theory, whichformally describes the most famous class of difficult problems.[5] Early uses of the term are in Erik Mueller’s 1987Ph.D. dissertation[6] and in Eric Raymond's 1991 Jargon File.[7]

1.2 AI-complete problems

AI-complete problems are hypothesised to include:

• Computer vision (and subproblems such as object recognition)

• Natural language understanding (and subproblems such as text mining, machine translation, and word sensedisambiguation)

• Dealing with unexpected circumstances while solving any real world problem, whether it’s navigation or planningor even the kind of reasoning done by expert systems.

1.2.1 Machine translation

Main article: Machine translation

To translate accurately, a machine must be able to understand the text. It must be able to follow the author’s argument,so it must have some ability to reason. It must have extensive world knowledge so that it knows what is being discussed— it must at least be familiar with all the same commonsense facts that the average human translator knows. Someof this knowledge is in the form of facts that can be explicitly represented, but some knowledge is unconscious andclosely tied to the human body: for example, the machine may need to understand how an ocean makes one feel toaccurately translate a specific metaphor in the text. It must also model the authors’ goals, intentions, and emotional

1

Page 9: Computational Problems

2 CHAPTER 1. AI-COMPLETE

states to accurately reproduce them in a new language. In short, the machine is required to have wide variety ofhuman intellectual skills, including reason, commonsense knowledge and the intuitions that underlie motion andmanipulation, perception, and social intelligence. Machine translation, therefore, is believed to be AI-complete: itmay require strong AI to be done as well as humans can do it.

1.3 Software brittleness

Main article: Software brittleness

Current AI systems can solve very simple restricted versions of AI-complete problems, but never in their full gen-erality. When AI researchers attempt to “scale up” their systems to handle more complicated, real world situations,the programs tend to become excessively brittle without commonsense knowledge or a rudimentary understandingof the situation: they fail as unexpected circumstances outside of its original problem context begin to appear. Whenhuman beings are dealing with new situations in the world, they are helped immensely by the fact that they know whatto expect: they know what all things around them are, why they are there, what they are likely to do and so on. Theycan recognize unusual situations and adjust accordingly. A machine without strong AI has no other skills to fall backon.[8]

1.4 Formalization

Computational complexity theory deals with the relative computational difficulty of computable functions. By defi-nition it does not cover problems whose solution is unknown or has not been characterised formally. Since many AIproblems have no formalisation yet, conventional complexity theory does not allow the definition of AI-completeness.To address this problem, a complexity theory for AI has been proposed.[9] It is based on a model of computation thatsplits the computational burden between a computer and a human: one part is solved by computer and the other partsolved by human. This is formalised by a human-assisted Turing machine. The formalisation defines algorithmcomplexity, problem complexity and reducibility which in turn allows equivalence classes to be defined.The complexity of executing an algorithm with a human-assisted Turing machine is given by a pair ⟨ΦH ,ΦM ⟩ ,where the first element represents the complexity of the human’s part and the second element is the complexity ofthe machine’s part.

1.4.1 Results

The complexity of solving the following problems with a human-assisted Turing machine is:[9]

• Optical character recognition for printed text: ⟨O(1), poly(n)⟩

• Turing test:

• for an n -sentence conversation where the oracle remembers the conversation history (persistent oracle):⟨O(n), O(n)⟩

• for an n -sentence conversation where the conversation history must be retransmitted: ⟨O(n), O(n2)⟩

• for an n -sentence conversation where the conversation history must be retransmitted and the person takeslinear time to read the query: ⟨O(n2), O(n2)⟩

• ESP game: ⟨O(n), O(n)⟩

• Image labelling (based on the Arthur–Merlin protocol): ⟨O(n), O(n)⟩

• Image classification: human only: ⟨O(n), O(n)⟩ , and with less reliance on the human: ⟨O(logn), O(n logn)⟩.

Page 10: Computational Problems

1.5. SEE ALSO 3

1.5 See also• ASR-complete

• List of unsolved problems in computer science

• Synthetic intelligence

1.6 References[1] Shapiro, Stuart C. (1992). Artificial Intelligence In Stuart C. Shapiro (Ed.), Encyclopedia of Artificial Intelligence (Second

Edition, pp. 54–57). New York: John Wiley. (Section 4 is on “AI-Complete Tasks”.)

[2] Roman V. Yampolskiy. Turing Test as a Defining Feature of AI-Completeness . In Artificial Intelligence, EvolutionaryComputation and Metaheuristics (AIECM) --In the footsteps of Alan Turing. Xin-She Yang (Ed.). pp. 3-17. (Chapter 1).Springer, London. 2013. http://cecs.louisville.edu/ry/TuringTestasaDefiningFeature04270003.pdf

[3] Luis von Ahn, Manuel Blum, Nicholas Hopper, and John Langford. CAPTCHA: Using Hard AI Problems for Security.In Proceedings of Eurocrypt, Vol. 2656 (2003), pp. 294-311.

[4] Bergmair, Richard (January 7, 2006). “Natural Language Steganography and an “AI-complete” Security Primitive”.CiteSeerX: 10 .1 .1 .105 .129. (unpublished?)

[5] Mallery, John C. (1988), “Thinking About Foreign Policy: Finding an Appropriate Role for Artificially Intelligent Com-puters”, The 1988 Annual Meeting of the International Studies Association., St. Louis, MO.

[6] Mueller, Erik T. (1987, March). Daydreaming and Computation (Technical Report CSD-870017) Ph.D. dissertation,University of California, Los Angeles. (“Daydreaming is but one more AI-complete problem: if we could solve any oneartificial intelligence problem, we could solve all the others”, p. 302)

[7] Raymond, Eric S. (1991, March 22). Jargon File Version 2.8.1 (Definition of “AI-complete” first added to jargon file.)

[8] Lenat, Douglas; Guha, R. V. (1989), Building Large Knowledge-Based Systems, Addison-Wesley, pp. 1–5

[9] Dafna Shahaf and Eyal Amir (2007) Towards a theory of AI completeness. Commonsense 2007, 8th International Sym-posium on Logical Formalizations of Commonsense Reasoning.

Page 11: Computational Problems

Chapter 2

Art gallery problem

The art gallery problem or museum problem is a well-studied visibility problem in computational geometry. Itoriginates from a real-world problem of guarding an art gallery with the minimum number of guards who togethercan observe the whole gallery. In the computational geometry version of the problem the layout of the art gallery isrepresented by a simple polygon and each guard is represented by a point in the polygon. A set S of points is said toguard a polygon if, for every point p in the polygon, there is some q ∈ S such that the line segment between p and qdoes not leave the polygon.

2.1 Two dimensions

There are numerous variations of the original problem that are also referred to as the art gallery problem. In someversions guards are restricted to the perimeter, or even to the vertices of the polygon. Some versions require only theperimeter or a subset of the perimeter to be guarded.Solving the version in which guards must be placed on vertices and only vertices need to be guarded is equivalent tosolving the dominating set problem on the visibility graph of the polygon.

2.1.1 Chvátal’s art gallery theorem

Chvátal’s art gallery theorem, named after Václav Chvátal, gives an upper bound on the minimal number of guards.It states that ⌊n/3⌋ guards are always sufficient and sometimes necessary to guard a simple polygon with n vertices.The question about how many vertices/watchmen/guards were needed was posed to Chvátal by Victor Klee in 1973.[1]

Chvátal proved it shortly thereafter.[2] Chvátal’s proof was later simplified by Steve Fisk, via a 3-coloring argument.[3]

2.1.2 Fisk’s short proof

Fisk (1978) proves the art gallery theorem as follows.First, the polygon is triangulated (without adding extra vertices). The vertices of the polygon are then 3-colored insuch a way that every triangle has all three colors. To find a 3-coloring, it is helpful to observe that the dual graph tothe triangulation (the undirected graph having one vertex per triangle and one edge per pair of adjacent triangles) isa tree, for any cycle in the dual graph would form the boundary of a hole in the polygon, contrary to the assumptionthat it has no holes. Whenever there is more than one triangle, the dual graph (like any tree) must have a vertexwith only one neighbor, corresponding to a triangle that is adjacent to other triangles along only one of its sides. Thesimpler polygon formed by removing this triangle has a 3-coloring by mathematical induction, and this coloring iseasily extended to the one additional vertex of the removed triangle.Once a 3-coloring is found, the vertices with any one color form a valid guard set, because every triangle of thepolygon is guarded by its vertex with that color. Since the three colors partition the n vertices of the polygon, thecolor with the fewest vertices forms a valid guard set with at most ⌊n/3⌋ guards.

4

Page 12: Computational Problems

2.1. TWO DIMENSIONS 5

Four cameras cover this gallery.

2.1.3 Generalizations

Chvátal’s upper bound remains valid if the restriction to guards at corners is loosened to guards at any point notexterior to the polygon.There are a number of other generalizations and specializations of the original art-gallery theorem.[4] For instance,for orthogonal polygons, those whose edges/walls meet at right angles, only ⌊n/4⌋ guards are needed. There are atleast three distinct proofs of this result, none of them simple: by Kahn, Klawe, and Kleitman; by Lubiw; and by Sackand Toussaint.[5]

A related problem asks for the number of guards to cover the exterior of an arbitrary polygon (the “Fortress Problem”):⌈n/2⌉ are sometimes necessary and always sufficient. In other words, the infinite exterior is more challenging to coverthan the finite interior.[6]

2.1.4 Computational complexity

In decision problem versions of the art gallery problem, one is given as input both a polygon and a number k, and mustdetermine whether the polygon can be guarded with k or fewer guards. This problem and all of its standard variations(such as restricting the guard locations to vertices or edges of the polygon) are NP-hard.[7] Regarding approximation

Page 13: Computational Problems

6 CHAPTER 2. ART GALLERY PROBLEM

A 3-coloring of the vertices of a triangulated polygon. The blue vertices form a set of three guards, as few as is guaranteed by theart gallery theorem. However, this set is not optimal: the same polygon can be guarded by only two guards.

algorithms for the minimum number of guards, Eidenbenz, Stamm & Widmayer (2001) proved the problem to beAPX-hard, implying that it is unlikely that any approximation ratio better than some fixed constant can be achievedby a polynomial time approximation algorithm. However, a constant approximation ratio is not known. Instead, alogarithmic approximation may be achieved for the minimum number of vertex guards by reducing the problem toa set cover problem.[8] As Valtr (1998) showed, the set system derived from an art gallery problem has boundedVC dimension, allowing the application of set cover algorithms based on ε-nets whose approximation ratio is thelogarithm of the optimal number of guards rather than of the number of polygon vertices.[9] For unrestricted guards,the infinite number of potential guard positions makes the problem even more difficult.[10]

However, efficient algorithms are known for finding a set of at most ⌊n/3⌋ vertex guards, matching Chvátal’s upperbound. David Avis and Godfried Toussaint (1981) proved that a placement for these guards may be computed inO(n log n) time in the worst case, via a divide and conquer algorithm. Kooshesh & Moret (1992) gave a linear timealgorithm by using Fisk’s short proof and Bernard Chazelle's linear time plane triangulation algorithm.An exact algorithm was proposed by Couto, de Rezende & de Souza (2011) for vertex guards. The authors conductedextensive computational experiments with several classes of polygons showing that optimal solutions can be foundin relatively small computation times even for instances associated to thousands of vertices. The input data and the

Page 14: Computational Problems

2.2. THREE DIMENSIONS 7

optimal solutions for these instances are available for download.[11]

2.2 Three dimensions

An example of a polyhedron with interior points not visible from any vertex.

If a museum is represented in three dimensions as a polyhedron, then putting a guard at each vertex will not ensurethat all of the museum is under observation. Although all of the surface of the polyhedron would be surveyed, forsome polyhedra there are points in the interior which might not be under surveillance.[12]

2.3 Notes[1] O'Rourke (1987), p. 1.

[2] Chvátal (1975).

[3] Fisk (1978).

[4] Shermer (1992).

[5] O'Rourke (1987), pp. 31–80; Kahn, Klawe & Kleitman (1983); Lubiw (1985); Sack & Toussaint (1988).

[6] O'Rourke (1987), pp. 146–154.

[7] O'Rourke (1987), pp. 239–242; Aggarwal (1984); Lee & Lin (1986).

[8] Ghosh (1987).

[9] Brönnimann & Goodrich (1995).

Page 15: Computational Problems

8 CHAPTER 2. ART GALLERY PROBLEM

[10] Deshpande et al. (2007)

[11] Couto, de Rezende & de Souza (2011).

[12] O'Rourke (1987), p. 255.

2.4 See also

• Polygon covering#Covering a rectilinear polygon with star polygons

2.5 References

• Aggarwal, A. (1984), The art gallery theorem: Its variations, applications, and algorithmic aspects, Ph.D. thesis,Johns Hopkins University.

• Avis, D.; Toussaint, G. T. (1981), “An efficient algorithm for decomposing a polygon into star-shaped polygons”(PDF), Pattern Recognition 13 (6): 395–398, doi:10.1016/0031-3203(81)90002-9.

• Brönnimann, H.; Goodrich, M. T. (1995), “Almost optimal set covers in finite VC-dimension”, Discrete andComputational Geometry 14 (1): 463–479, doi:10.1007/BF02570718.

• Chvátal, V. (1975), “A combinatorial theorem in plane geometry”, Journal of Combinatorial Theory, Series B18: 39–41, doi:10.1016/0095-8956(75)90061-1.

• Couto, M.; de Rezende, P.; de Souza, C. (2011), “An exact algorithm for minimizing vertex guards on art gal-leries”, International Transactions in Operational Research: no–no, doi:10.1111/j.1475-3995.2011.00804.x.

• Couto, M.; de Rezende, P.; de Souza, C. (2011), Benchmark instances for the art gallery problem with vertexguards.

• Deshpande, Ajay; Kim, Taejung; Demaine, Erik D.; Sarma, Sanjay E. (2007), “A Pseudopolynomial TimeO(logn)-Approximation Algorithm for Art Gallery Problems”, Proc. Worksh. Algorithms and Data Structures,Lecture Notes in Computer Science 4619, Springer-Verlag, pp. 163–174, doi:10.1007/978-3-540-73951-7_15, ISBN 978-3-540-73948-7.

• Eidenbenz, S.; Stamm, C.; Widmayer, P. (2001), “Inapproximability results for guarding polygons and terrains”(PDF), Algorithmica 31 (1): 79–113, doi:10.1007/s00453-001-0040-8.

• Fisk, S. (1978), “A short proof of Chvátal’s watchman theorem”, Journal of Combinatorial Theory, Series B24 (3): 374, doi:10.1016/0095-8956(78)90059-X.

• Ghosh, S. K. (1987), “Approximation algorithms for art gallery problems”, Proc. Canadian Information Pro-cessing Society Congress, pp. 429–434.

• Kahn, J.; Klawe, M.; Kleitman, D. (1983), “Traditional galleries require fewer watchmen”, SIAM J. Alg. Disc.Meth. 4 (2): 194–206, doi:10.1137/0604020.

• Kooshesh, A. A.; Moret, B. M. E. (1992), “Three-coloring the vertices of a triangulated simple polygon”,Pattern Recognition 25 (4): 443, doi:10.1016/0031-3203(92)90093-X.

• Lee, D. T.; Lin, A. K. (1986), “Computational complexity of art gallery problems”, IEEE Transactions onInformation Theory 32 (2): 276–282, doi:10.1109/TIT.1986.1057165.

• Lubiw, A. (1985), “Decomposing polygonal regions into convex quadrilaterals”, Proc. 1st ACM Symposium onComputational Geometry, pp. 97–106, doi:10.1145/323233.323247, ISBN 0-89791-163-6.

• O'Rourke, Joseph (1987), Art Gallery Theorems and Algorithms, Oxford University Press, ISBN 0-19-503965-3.

• Sack, J. R.; Toussaint, G. T. (1988), “Guard placement in rectilinear polygons”, in Toussaint, G. T., Compu-tational Morphology, North-Holland, pp. 153–176.

Page 16: Computational Problems

2.5. REFERENCES 9

• Shermer, Thomas (1992), “Recent Results in Art Galleries” (PDF), Proceedings of the IEEE 80 (9): 1384–1399, doi:10.1109/5.163407.

• Valtr, P. (1998), “Guarding galleries where no point sees a small area”, Israel J. Math. 104 (1): 1–16,doi:10.1007/BF02897056.

Page 17: Computational Problems

Chapter 3

Circuit satisfiability problem

In theoretical computer science, the circuit satisfiability problem (also known as CIRCUIT-SAT, CircuitSAT,CSAT, etc.) is the decision problem of determining whether a given Boolean circuit has an assignment of its inputsthat makes the output true.[1]

3.1 Properties

CircuitSAT has been proven to be NP-complete.[2] In fact, it is a prototypical NP-complete problem; the Cook–Levintheorem is sometimes proved on CircuitSAT instead of on SAT for Boolean expressions and then reduced to the othersatisfiability problems to prove their NP-completeness.[1][3]

The satisfiability of a circuit containing m arbitrary binary gates can be decided in time O(20.4058m) .[4]

3.2 The Tseitin transformation

Main article: Tseitin transformation

There is a straightforward reduction from CircuitSAT to SAT, known as the Tseitin transformation. The transfor-mation is especially easy to describe if the circuit is wholly constructed from 2-input NAND gates (a functionally-complete set of Boolean operators): assign every net in the circuit a variable, then for each NAND gate, constructthe conjunctive normal form clauses (v1 ∨ v3) ∧ (v2 ∨ v3) ∧ (¬v1 ∨ ¬v2 ∨ ¬v3) where v1 and v2 are the inputs tothe NAND gate and v3 is the output. These clauses completely describe the relationship between the three variables.Conjoining the clauses from all the gates with an additional clause constraining the circuit’s output variable to be truecompletes the reduction; an assignment of the variables satisfying all of the constraints exists if and only if the originalcircuit is satisfiable, and any solution is a solution to the original problem of finding inputs that make the circuit output1.[1][5] (The converse, that SAT is reducible to CircuitSAT, is even easier—we simply rewrite the Boolean formulaas a circuit and solve that.)

3.3 References[1] David Mix Barrington and Alexis Maciel (July 5, 2000). “Lecture 7: NP-Complete Problems”.

[2] Luca Trevisan (November 29, 2001). “Notes for Lecture 23: NP-completeness of Circuit-SAT”.

[3] See also, for example, the informal proof given in Scott Aaronson's lecture notes from his course Quantum Computing SinceDemocritus.

[4] Sergey Nurk (December 1, 2009). “An O(2^0.4058m) upper bound for Circuit SAT”.

[5] Marques-Silva, João P. and Luís Guerra e Silva (1999). “Algorithms for Satisfiability in Combinational Circuits Based onBacktrack Search and Recursive Learning”.

10

Page 18: Computational Problems

3.4. SEE ALSO 11

3.4 See also• Satisfiability problem

Page 19: Computational Problems

Chapter 4

Computational problem

In theoretical computer science, a computational problem is a mathematical object representing a collection ofquestions that computers might be able to solve. For example, the problem of factoring

“Given a positive integer n, find a nontrivial prime factor of n.”

is a computational problem. Computational problems are one of the main objects of study in theoretical computerscience. The field of algorithms studies methods of solving computational problems efficiently. The complemen-tary field of computational complexity attempts to explain why certain computational problems are intractable forcomputers.A computational problem can be viewed as an infinite collection of instances together with a solution for every instance.For example in the factoring problem, the instances are the integers n, and solutions are prime numbers p that describenontrivial prime factors of n.It is conventional to represent both instances and solutions by binary strings, namely elements of 0, 1*. For example,numbers can be represented as binary strings using the binary encoding. (For readability, we identify numbers withtheir binary encodings in the examples below.)

4.1 Types of computational problems

A decision problem is a computational problem where the answer for every instance is either yes or no. An exampleof a decision problem is primality testing:

“Given a positive integer n, determine if n is prime.”

A decision problem is typically represented as the set of all instances for which the answer is yes. For example,primality testing can be represented as the infinite set

L = 2, 3, 5, 7, 11, ...

In a search problem, the answers can be arbitrary strings. For example, factoring is a search problem where theinstances are (string representations of) positive integers and the solutions are (string representations of) collectionsof primes.A search problem is represented as a relation consisting of all the instance-solution pairs, called a search relation. Forexample, factoring can be represented as the relation

R = (4, 2), (6, 2), (6, 3), (8, 2), (9, 3), (10, 2), (10, 5)...

which consist of all pairs of numbers (n, p), where p is a nontrivial prime factor of n.A counting problem asks for the number of solutions to a given search problem. For example, a counting problemassociated with factoring is

12

Page 20: Computational Problems

4.2. PROMISE PROBLEMS 13

“Given a positive integer n, count the number of nontrivial prime factors of n.”

A counting problem can be represented by a function f from 0, 1* to the nonnegative integers. For a search relationR, the counting problem associated to R is the function

fR(x) = |y: R(x, y) |.

An optimization problem asks for finding a “best possible” solution among the set of all possible solutions to a searchproblem. One example is the maximum independent set problem:

“Given a graph G, find an independent set of G of maximum size.”

Optimization problems can be represented by their search relations.In a function problem a single output (of a total function) is expected for every input, but the output is more complexthan that of a decision problem, that is, it isn't just “yes” or “no”. One of the most famous examples is the travellingsalesman problem:

“Given a list of cities and the distances between each pair of cities, find the shortest possible route thatvisits each city exactly once and returns to the origin city.”

It is an NP-hard problem in combinatorial optimization, important in operations research and theoretical computerscience.

4.2 Promise problems

Main article: Promise problem

In computational complexity theory, it is usually implicitly assumed that any string in 0, 1* represents an instanceof the computational problem in question. However, sometimes not all strings 0, 1* represent valid instances, andone specifies a proper subset of 0, 1* as the set of “valid instances”. Computational problems of this type are calledpromise problems.The following is an example of a (decision) promise problem:

“Given a graph G, determine if every independent set in G has size at most 5, or G has an independentset of size at least 10.”

Here, the valid instances are those graphs whose maximum independent set size is either at most 5 or at least 10.Decision promise problems are usually represented as pairs of disjoint subsets (L ₑ , L ₒ) of 0, 1*. The validinstances are those in L ₑ ∪ L ₒ. L ₑ and L ₒ represent the instances whose answer is yes and no, respectively.Promise problems play an important role in several areas of computational complexity, including hardness of ap-proximation, property testing, and interactive proof systems.

4.3 References• Even, Shimon; Selman, Alan L.; Yacobi, Yacov (1984), “The complexity of promise problems with applica-

tions to public-key cryptography”, Information and Control 61 (2): 159–173, doi:10.1016/S0019-9958(84)80056-X.

• Goldreich, Oded (2008), Computational Complexity: A Conceptual Perspective, Cambridge University Press,ISBN 978-0-521-88473-0.

• Goldreich, Oded; Wigderson, Avi (2008), “IV.20 Computational Complexity”, in Gowers, Timothy; Barrow-Green, June; Leader, Imre, The Princeton Companion to Mathematics, Princeton University Press, pp. 575–604, ISBN 978-0-691-11880-2.

Page 21: Computational Problems

Chapter 5

Computing the permanent

In mathematics, the computation of the permanent of a matrix is a problem that is known to be more difficultthan the computation of the determinant of a matrix despite the apparent similarity of the definitions.The permanent is defined similarly to the determinant, as a sum of products of sets of matrix entries that lie in distinctrows and columns. However, where the determinant weights each of these products with a ±1 sign based on the parityof the set, the permanent weights them all with a +1 sign.While the determinant can be computed in polynomial time by Gaussian elimination, the permanent cannot. Incomputational complexity theory, a theorem of Valiant states that computing permanents is #P-hard, and even #P-complete for matrices in which all entries are 0 or 1.Valiant (1979) This puts the computation of the permanent in aclass of problems believed to be even more difficult to compute than NP. It is known that computing the permanentis impossible for logspace-uniform ACC0 circuits.(Allender & Gore 1994)The development of both exact and approximate algorithms for computing the permanent of a matrix is an activearea of research.

5.1 Definition and naive algorithm

The permanent of an n-by-n matrix A = (ai,j) is defined as

perm(A) =∑σ∈Sn

n∏i=1

ai,σ(i).

The sum here extends over all elements σ of the symmetric group Sn, i.e. over all permutations of the numbers 1, 2,..., n. This formula differs from the corresponding formula for the determinant only in that, in the determinant, eachproduct is multiplied by the sign of the permutation σ while in this formula each product is unsigned. The formulamay be directly translated into an algorithm that naively expands the formula, summing over all permutations andwithin the sum multiplying out each matrix entry. This requires n! n arithmetic operations.

5.2 Ryser formula

The best known[1] general exact algorithm is due to H. J. Ryser (1963). Ryser’s method is based on an inclusion–exclusion formula that can be given[2] as follows: Let Ak be obtained from A by deleting k columns, let P (Ak) bethe product of the row-sums of Ak , and let Σk be the sum of the values of P (Ak) over all possible Ak . Then

perm(A) =

n−1∑k=0

(−1)kΣk.

It may be rewritten in terms of the matrix entries as follows[3]

14

Page 22: Computational Problems

5.3. BALASUBRAMANIAN-BAX/FRANKLIN-GLYNN FORMULA 15

perm(A) = (−1)n∑

S⊆1,...,n

(−1)|S|n∏

i=1

∑j∈S

aij .

Ryser’s formula can be evaluated using O(2nn2) arithmetic operations, or O(2nn) by processing the sets S in Graycode order.

5.3 Balasubramanian-Bax/Franklin-Glynn formula

Another formula that appears to be as fast as Ryser’s (or perhaps even twice as fast) is to be found in the two Ph.D.theses; see (Balasubramanian 1980), (Bax 1998); also (Bax 1996). The methods to find the formula are quite different,being related to the combinatorics of the Muir algebra, and to finite difference theory respectively. Another way,connected with invariant theory is via the polarization identity for a symmetric tensor (Glynn 2010). The formulageneralizes to infinitely many others, as found by all these authors, although it is not clear if they are any faster thanthe basic one. See (Glynn 2013).The simplest known formula of this type (when the characteristic of the field is not two) is

perm(A) =

∑δ

(m∏

k=1

δk

)m∏j=1

m∑i=1

δiaij

/2m−1,

where the outer sum is over all 2m−1 vectors δ = (δ1 = 1, δ2, . . . , δm) ∈ ±1m .

5.4 Special cases

5.4.1 Planar and K₃,₃-free

The number of perfect matchings in a bipartite graph is counted by the permanent of the graph’s biadjacency matrix,and the permanent of any 0-1 matrix can be interpreted in this way as the number of perfect matchings in a graph.For planar graphs (regardless of bipartiteness), the FKT algorithm computes the number of perfect matchings inpolynomial time by changing the signs of a carefully chosen subset of the entries in the Tutte matrix of the graph, sothat the Pfaffian of the resulting skew-symmetric matrix (the square root of its determinant) is the number of perfectmatchings. This technique can be generalized to graphs that contain no subgraph homeomorphic to the completebipartite graph K₃,₃.[4]

George Pólya had asked the question[5] of when it is possible to change the signs of some of the entries of a 01 matrixA so that the determinant of the new matrix is the permanent of A. Not all 01 matrices are “convertible” in thismanner; in fact it is known (Marcus & Minc (1961)) that there is no linear map T such that per T (A) = detA forall n × n matrices A . The characterization of “convertible” matrices was given by Little (1975) who showed thatsuch matrices are precisely those that are the biadjacency matrix of bipartite graphs that have a Pfaffian orientation:an orientation of the edges such that for every even cycle C for which G \C has a perfect matching, there are an oddnumber of edges directed along C (and thus an odd number with the opposite orientation). It was also shown thatthese graphs are exactly those that do not contain a subgraph homeomorphic to K3,3 , as above.

5.4.2 Computation modulo a number

Modulo 2, the permanent is the same as the determinant, as (−1) ≡ 1 (mod 2). It can also be computed modulo 2k

in time O(n4k−3) for k ≥ 2 . However, it is UP-hard to compute the permanent modulo any number that is not apower of 2. Valiant (1979)There are various formulae given by Glynn (2010) for the computation modulo a prime p . Firstly there is one usingsymbolic calculations with partial derivatives.Secondly, for p = 3 there is the following formula (Grigoriy Kogan, 1996) using the determinants of the principalsubmatrices of the matrix:

Page 23: Computational Problems

16 CHAPTER 5. COMPUTING THE PERMANENT

perm(A) = (−1)mΣU⊆1,...,m det(AU ). det(AU ),

where AU is the principal submatrix of A induced by the rows and columns of A indexed by U , and U is thecomplement of U in 1, . . . ,m.(The determinant of an empty submatrix is defined to be 1).This formula implies the following identities over fields of Characteristic 3 (Grigoriy Kogan, 1996):for any invertible A

perm(A−1) det(A)2 = perm(A)

for any unitary U , i.e. a square matrix U such that UTU = I ,

perm(U)2 = det(U + V ) det(U)

where V is the matrix whose entries are the cubes of the corresponding entries of U .

5.5 Approximate computation

When the entries of A are nonnegative, the permanent can be computed approximately in probabilistic polynomialtime, up to an error of εM, where M is the value of the permanent and ε > 0 is arbitrary. In other words, there existsa fully polynomial-time randomized approximation scheme (FPRAS) (Jerrum, Vigoda & Sinclair (2001)).The most difficult step in the computation is the construction of an algorithm to sample almost uniformly from theset of all perfect matchings in a given bipartite graph: in other words, a fully polynomial almost uniform sampler(FPAUS). This can be done using a Markov chain Monte Carlo algorithm that uses a Metropolis rule to define andrun a Markov chain whose distribution is close to uniform, and whose mixing time is polynomial.It is possible to approximately count the number of perfect matchings in a graph via the self-reducibility of thepermanent, by using the FPAUS in combination with a well-known reduction from sampling to counting due toJerrum, Valiant & Vazirani (1986). Let M(G) denote the number of perfect matchings in G . Roughly, for anyparticular edge e in G , by sampling many matchings in G and counting how many of them are matchings in G \ e ,one can obtain an estimate of the ratio ρ = M(G)

M(G\e) . The number M(G) is then ρM(G \ e) , where M(G \ e) canbe approximated by applying the same method recursively.

5.6 Notes[1] As of 2008, see Rempala & Wesolowski (2008)

[2] van Lint & Wilson (2001) p. 99

[3] CRC Concise Encyclopedia of Mathematics ()

[4] Little (1974), Vazirani (1988)

[5] Pólya (1913), Reich (1971)

5.7 References• Allender, Eric; Gore, Vivec (1994), “A uniform circuit lower bound for the permanent”, SIAM Journal on

Computing 23 (5): 1026–1049, doi:10.1137/s0097539792233907

• Balasubramanian, K. (1980), Combinatorics and Diagonals ofMatrices, Ph.D. Thesis, Department of Statistics,Loyola College, Madras, India T073, Indian Statistical Institute, Calcutta

Page 24: Computational Problems

5.7. REFERENCES 17

• Bax, Eric (1998), Finite-difference Algorithms for Counting Problems, Ph.D. Dissertation 223, California Insti-tute of Technology

• Bax, Eric; Franklin, J. (1996), A finite-difference sieve to compute the permanent, CalTech-CS-TR-96-04,California Institute of Technology

• Glynn, David G. (2010), “The permanent of a square matrix”, European Journal of Combinatorics 31 (7):1887–1891, doi:10.1016/j.ejc.2010.01.010

• Glynn, David G. (2013), “Permanent formulae from the Veronesean”, Designs Codes and Cryptography 68(1-3): 39–47, doi:10.1007/s10623-012-9618-1

• Jerrum, M.; Sinclair, A.; Vigoda, E. (2001), “A polynomial-time approximation algorithm for the perma-nent of a matrix with non-negative entries”, Proc. 33rd Symposium on Theory of Computing, pp. 712–721,doi:10.1145/380752.380877, ECCC TR00-079

• Mark Jerrum; Leslie Valiant; Vijay Vazirani (1986), “Random generation of combinatorial structures from auniform distribution”, Theoretical Computer Science 43: 169–188, doi:10.1016/0304-3975(86)90174-X

• Kogan, Grigoriy (1996), “Computing permanents over fields of characteristic 3: where and why it becomesdifficult”, 37th Annual Symposium on Foundations of Computer Science (FOCS '96)

• van Lint, Jacobus Hendricus; Wilson, Richard Michale (2001), ACourse in Combinatorics, ISBN 0-521-00601-5

• Little, C. H. C. (1974), “An extension of Kasteleyn’s method of enumerating the 1-factors of planar graphs”,in Holton, D., Proc. 2nd Australian Conf. Combinatorial Mathematics, Lecture Notes in Mathematics 403,Springer-Verlag, pp. 63–72

• Little, C. H. C. (1975), “A characterization of convertible (0, 1)-matrices”, Journal of Combinatorial Theory,Series B 18 (3): 187–208, doi:10.1016/0095-8956(75)90048-9

• Marcus, M.; Minc, H. (1961), “On the relation between the determinant and the permanent”, Illinois Journalof Mathematics 5: 376–381

• Pólya, G. (1913), “Aufgabe 424”, Arch. Math. Phys. 20 (3): 27

• Reich, Simeon (1971), “Another solution of an old problem of pólya”, American Mathematical Monthly 78 (6):649–650, doi:10.2307/2316574, JSTOR 2316574

• Rempała, Grzegorz A.; Wesolowski, Jacek (2008), Symmetric Functionals on Random Matrices and RandomMatchings Problems, p. 4, ISBN 0-387-75145-9

• Ryser, Herbert John (1963), Combinatorial Mathematics, The Carus mathematical monographs, The Mathe-matical Association of America

• Vazirani, Vijay V. (1988), “NC algorithms for computing the number of perfect matchings in K₃,₃-free graphsand related problems”, Proc. 1st Scandinavian Workshop on Algorithm Theory (SWAT '88), Lecture Notes inComputer Science 318, Springer-Verlag, pp. 233–242, doi:10.1007/3-540-19487-8_27

• Valiant, Leslie G. (1979), “The Complexity of Computing the Permanent”, Theoretical Computer Science (El-sevier) 8 (2): 189–201, doi:10.1016/0304-3975(79)90044-6

• “Permanent”, CRC Concise Encyclopedia of Mathematics, Chapman & Hall/CRC, 2002

Page 25: Computational Problems

Chapter 6

Counting problem (complexity)

In computational complexity theory and computability theory, a counting problem is a type of computational prob-lem. If R is a search problem then

cR(x) = |y | R(x, y)|

is the corresponding counting function and

#R = (x, y) | y ≤ cR(x)

denotes the corresponding counting problem.Note that cR is a search problem while #R is a decision problem, however cR can be C Cook reduced to #R (forappropriate C) using a binary search (the reason #R is defined the way it is, rather than being the graph of cR, is tomake this binary search possible).

6.1 Counting complexity class

If NC is a complexity class associated with non-deterministic machines then #C = #R | R ∈ NC is the set of countingproblems associated with each search problem in NC. In particular, #P is the class of counting problems associatedwith NP search problems.

6.2 External links• counting problem at PlanetMath.org.

• counting complexity class at PlanetMath.org.

18

Page 26: Computational Problems

Chapter 7

Covering problems

In combinatorics and computer science, covering problems are computational problems that ask whether a certaincombinatorial structure 'covers’ another, or how large the structure has to be to do that. Covering problems areminimization problems and usually linear programs, whose dual problems are called packing problems.The most prominent examples of covering problems are the set cover problem, which is equivalent to the hitting setproblem, and its special cases, the vertex cover problem and the edge cover problem.

7.1 General LP formulation

In the context of linear programming, one can think of any linear program as a covering problem if the coefficientsin the constraint matrix, the objective function, and right-hand side are nonnegative.[1] More precisely, let us considerthe following general integer linear program:Such an integer linear program is called covering problem if aij , bj , ci ≥ 0 for all i = 1, . . . , n and j = 1, . . . ,m .Intuition: Assume having n types of object and each object of type i has an associated cost of ci . The number xi

indicates how many objects of type i we buy. If the constraints Ax ≥ b are satisfied, it is said that x is a covering (thestructures that are covered depend on the combinatorial context). Finally, an optimal solution to the above integerlinear program is a covering of minimal cost.

7.2 Other uses

For Petri nets, for example, the covering problem is defined as the question if for a given marking, there exists a runof the net, such that some larger (or equal) marking can be reached. Larger means here that all components are atleast as large as the ones of the given marking and at least one is properly larger.

7.3 See also• The biclique edge cover problem asks for covering all edges of a given graph with (as few as possible) complete

bipartite subgraphs.

• Disk covering problem, the problem of covering a unit circle with smaller circles

• Polygon covering, the problem of covering a complex polygon with simpler polygons such as squares or rect-angles.

7.4 Notes[1] Vazirani (2001, p. 112)

19

Page 27: Computational Problems

20 CHAPTER 7. COVERING PROBLEMS

7.5 References• Vazirani, Vijay V. (2001). Approximation Algorithms. Springer-Verlag. ISBN 3-540-65367-8.

7.6 External links• Erich’s Packing Center contains some illustrations of geometric covering problems.

Page 28: Computational Problems

Chapter 8

Decision problem

This article is about decision problems in complexity theory. For the decision problem in formal logic, see Entscheidungsproblem.In computability theory and computational complexity theory, a decision problem is a question in some formal sys-

tem with a yes-or-no answer, depending on the values of some input parameters. Decision problems typically appearin mathematical questions of decidability, that is, the question of the existence of an effective method to determinethe existence of some object or its membership in a set; some of the most important problems in mathematics areundecidable.For example, the problem “given two numbers x and y, does x evenly divide y?" is a decision problem. The answercan be either 'yes’ or 'no', and depends upon the values of x and y. A method for solving a decision problem, givenin the form of an algorithm, is called a decision procedure for that problem. A decision procedure for the decisionproblem “given two numbers x and y, does x evenly divide y?" would give the steps for determining whether x evenlydivides y, given x and y. One such algorithm is long division, taught to many school children. If the remainder is zerothe answer produced is 'yes’, otherwise it is 'no'. A decision problem which can be solved by an algorithm, such asthis example, is called decidable.The field of computational complexity categorizes decidable decision problems by how difficult they are to solve.“Difficult”, in this sense, is described in terms of the computational resources needed by the most efficient algorithmfor a certain problem. The field of recursion theory, meanwhile, categorizes undecidable decision problems by Turingdegree, which is a measure of the noncomputability inherent in any solution. Decision problems are closely related tofunction problems, which can have answers that are more complex than a simple 'yes’ or 'no'. A corresponding func-tion problem is “given two numbers x and y, what is x divided by y?". They are also related to optimization problems,which are concerned with finding the best answer to a particular problem. There are standard techniques for trans-forming function and optimization problems into decision problems, and vice versa, that do not significantly changethe computational difficulty of these problems. For this reason, research in computability theory and complexitytheory have typically focused on decision problems.

8.1 Definition

A decision problem is any arbitrary yes-or-no question on an infinite set of inputs. Because of this, it is traditional todefine the decision problem equivalently as: the set of inputs for which the problem returns yes.These inputs can be natural numbers, but may also be values of some other kind, such as strings over the binaryalphabet 0,1 or over some other finite set of symbols. The subset of strings for which the problem returns “yes” isa formal language, and often decision problems are defined in this way as formal languages.Alternatively, using an encoding such as Gödel numberings, any string can be encoded as a natural number, via whicha decision problem can be defined as a subset of the natural numbers.

8.2 Examples

A classic example of a decidable decision problem is the set of prime numbers. It is possible to effectively decidewhether a given natural number is prime by testing every possible nontrivial factor. Although much more efficient

21

Page 29: Computational Problems

22 CHAPTER 8. DECISION PROBLEM

A decision problem has only two possible outputs, yes or no (or alternately 1 or 0) on any input.

methods of primality testing are known, the existence of any effective method is enough to establish decidability.

8.3 Decidability

Main article: Undecidable problem

A decision problem A is called decidable or effectively solvable if A is a recursive set. A problem is called partiallydecidable, semidecidable, solvable, or provable if A is a recursively enumerable set. Problems that are not decidable

Page 30: Computational Problems

8.4. COMPLETE PROBLEMS 23

are called undecidable.The halting problem is an important undecidable decision problem; for more examples, see list of undecidable prob-lems.

8.4 Complete problems

Main article: Complete problem

Decision problems can be ordered according to many-one reducibility and related feasible reductions such as polynomial-time reductions. A decision problem P is said to be complete for a set of decision problems S if P is a member of Sand every problem in S can be reduced to P. Complete decision problems are used in computational complexity tocharacterize complexity classes of decision problems. For example, the Boolean satisfiability problem is completefor the class NP of decision problems under polynomial-time reducibility.

8.5 Equivalence with function problems

A function problem consists of a partial function f; the informal “problem” is to compute the values of f on the inputsfor which it is defined.Every function problem can be turned into a decision problem; the decision problem is just the graph of the associatedfunction. (The graph of a function f is the set of pairs (x,y) such that f(x) = y.) If this decision problem were effectivelysolvable then the function problem would be as well. This reduction does not respect computational complexity,however. For example, it is possible for the graph of a function to be decidable in polynomial time (in which caserunning time is computed as a function of the pair (x,y) ) when the function is not computable in polynomial time (inwhich case running time is computed as a function of x alone). The function f(x) = 2x has this property.Every decision problem can be converted into the function problem of computing the characteristic function of the setassociated to the decision problem. If this function is computable then the associated decision problem is decidable.However, this reduction is more liberal than the standard reduction used in computational complexity (sometimescalled polynomial-time many-one reduction); for example, the complexity of the characteristic functions of an NP-complete problem and its co-NP-complete complement is exactly the same even though the underlying decisionproblems may not be considered equivalent in some typical models of computation.

8.6 See also

• ALL (complexity)

• Computational problem

• Decidability (logic) – for the problem of deciding whether a formula is a consequence of a logical theory.

• yes-no question

• Optimization problem

• Search problem

• Counting problem (complexity)

• Function problem

• Word problem (mathematics)

Page 31: Computational Problems

24 CHAPTER 8. DECISION PROBLEM

8.7 References• Kozen, D.C. (1997), Automata and Computability, Springer.

• Hartley Rogers, Jr., The Theory of Recursive Functions and Effective Computability, MIT Press, ISBN 0-262-68052-1 (paperback), ISBN 0-07-053522-1

• Sipser, M. (1996), Introduction to the Theory of Computation, PWS Publishing Co.

• Robert I. Soare (1987), Recursively Enumerable Sets and Degrees, Springer-Verlag, ISBN 0-387-15299-7

• Daniel Kroening & Ofer Strichman, Decision procedures, Springer, ISBN 978-3-540-74104-6

• Aaron Bradley & Zohar Manna, The calculus of computation, Springer, ISBN 978-3-540-74112-1

Page 32: Computational Problems

Chapter 9

Dining philosophers problem

In computer science, the dining philosophers problem is an example problem often used in concurrent algorithmdesign to illustrate synchronization issues and techniques for resolving them.It was originally formulated in 1965 by Edsger Dijkstra as a student exam exercise, presented in terms of computerscompeting for access to tape drive peripherals. Soon after, Tony Hoare gave the problem its present formulation.[1][2][3]

9.1 Problem statement

Five silent philosophers sit at a round table with bowls of spaghetti. Forks are placed between each pair of adjacentphilosophers. (An alternative problem formulation uses rice and chopsticks instead of spaghetti and forks).Each philosopher must alternately think and eat. However, a philosopher can only eat spaghetti when he has bothleft and right forks. Each fork can be held by only one philosopher and so a philosopher can use the fork only if itis not being used by another philosopher. After he finishes eating, he needs to put down both forks so they becomeavailable to others. A philosopher can take the fork on his right or the one on his left as they become available, butcannot start eating before getting both of them.Eating is not limited by the remaining amounts of spaghetti or stomach space; an infinite supply is assumed.The problem is how to design a discipline of behavior (a concurrent algorithm) such that each philosopher will notstarve; i.e., can forever continue to alternate between eating and thinking, assuming that any philosopher cannot knowwhen others may want to eat or think.

9.1.1 Problems

The problem was designed to illustrate the challenges of avoiding deadlock, a system state in which no progress ispossible. To see that a proper solution to this problem is not obvious, consider a proposal in which each philosopheris instructed to behave as follows:

• think until the left fork is available; when it is, pick it up;

• think until the right fork is available; when it is, pick it up;

• when both forks are held, eat for a fixed amount of time;

• then, put the right fork down;

• then, put the left fork down;

• repeat from the beginning.

This attempted solution fails because it allows the system to reach a deadlock state, in which no progress is possible.This is the state in which each philosopher has picked up the fork to the left, and is waiting for the fork to the right

25

Page 33: Computational Problems

26 CHAPTER 9. DINING PHILOSOPHERS PROBLEM

Illustration of the dining philosophers problem

to become available. With the given instructions, this state can be reached, and when it is reached, the philosopherswill eternally wait for each other to release a fork.[4]

Resource starvation might also occur independently of deadlock if a particular philosopher is unable to acquire bothforks because of a timing problem. For example there might be a rule that the philosophers put down a fork afterwaiting ten minutes for the other fork to become available and wait a further ten minutes before making their nextattempt. This scheme eliminates the possibility of deadlock (the system can always advance to a different state) butstill suffers from the problem of livelock. If all five philosophers appear in the dining room at exactly the same timeand each picks up the left fork at the same time the philosophers will wait ten minutes until they all put their forksdown and then wait a further ten minutes before they all pick them up again.Mutual exclusion is the basic idea of the problem; the dining philosophers create a generic and abstract scenario usefulfor explaining issues of this type. The failures these philosophers may experience are analogous to the difficulties thatarise in real computer programming when multiple programs need exclusive access to shared resources. These issuesare studied in the branch of concurrent programming. The original problems of Dijkstra were related to externaldevices like tape drives. However, the difficulties exemplified by the dining philosophers problem arise far moreoften when multiple processes access sets of data that are being updated. Systems such as operating system kernelsuse thousands of locks and synchronizations that require strict adherence to methods and protocols if such problems

Page 34: Computational Problems

9.2. SOLUTIONS 27

as deadlock, starvation, or data corruption are to be avoided.

9.2 Solutions

9.2.1 Resource hierarchy solution

This solution to the problem is the one originally proposed by Dijkstra. It assigns a partial order to the resources(the forks, in this case), and establishing the convention that all resources will be requested in order, and that notwo resources unrelated by order will ever be used by a single unit of work at the same time. Here, the resources(forks) will be numbered 1 through 5 and each unit of work (philosopher) will always pick up the lower-numberedfork first, and then the higher-numbered fork, from among the two forks he plans to use. The order in which eachphilosopher puts down the forks does not matter. In this case, if four of the five philosophers simultaneously pick uptheir lower-numbered fork, only the highest numbered fork will remain on the table, so the fifth philosopher will notbe able to pick up any fork. Moreover, only one philosopher will have access to that highest-numbered fork, so hewill be able to eat using two forks.While the resource hierarchy solution avoids deadlocks, it is not always practical, especially when the list of requiredresources is not completely known in advance. For example, if a unit of work holds resources 3 and 5 and thendetermines it needs resource 2, it must release 5, then 3 before acquiring 2, and then it must re-acquire 3 and 5 inthat order. Computer programs that access large numbers of database records would not run efficiently if they wererequired to release all higher-numbered records before accessing a new record, making the method impractical forthat purpose.

9.2.2 Arbitrator solution

Another approach is to guarantee that a philosopher can only pick up both forks or none by introducing an arbitrator,e.g., a waiter. In order to pick up the forks, a philosopher must ask permission of the waiter. The waiter givespermission to only one philosopher at a time until he has picked up both his forks. Putting down a fork is alwaysallowed. The waiter can be implemented as a mutex. In addition to introducing a new central entity (the waiter), thisapproach can result in reduced parallelism: if a philosopher is eating and one of his neighbors is requesting the forks,all other philosophers must wait until this request has been fulfilled even if forks for them are still available.

9.2.3 Chandy/Misra solution

In 1984, K. Mani Chandy and J. Misra[5] proposed a different solution to the dining philosophers problem to allow forarbitrary agents (numbered P1, ..., Pn) to contend for an arbitrary number of resources, unlike Dijkstra’s solution. It isalso completely distributed and requires no central authority after initialization. However, it violates the requirementthat “the philosophers do not speak to each other” (due to the request messages).

1. For every pair of philosophers contending for a resource, create a fork and give it to the philosopher with thelower ID (n for agent Pn). Each fork can either be dirty or clean. Initially, all forks are dirty.

2. When a philosopher wants to use a set of resources (i.e. eat), he must obtain the forks from his contendingneighbors. For all such forks he does not have, he sends a request message.

3. When a philosopher with a fork receives a request message, he keeps the fork if it is clean, but gives it up whenit is dirty. If he sends the fork over, he cleans the fork before doing so.

4. After a philosopher is done eating, all his forks become dirty. If another philosopher had previously requestedone of the forks, he cleans the fork and sends it.

This solution also allows for a large degree of concurrency, and will solve an arbitrarily large problem.It also solves the starvation problem. The clean / dirty labels act as a way of giving preference to the most “starved”processes, and a disadvantage to processes that have just “eaten”. One could compare their solution to one wherephilosophers are not allowed to eat twice in a row without letting others use the forks in between. Their solution ismore flexible than that, but has an element tending in that direction.

Page 35: Computational Problems

28 CHAPTER 9. DINING PHILOSOPHERS PROBLEM

In their analysis they derive a system of preference levels from the distribution of the forks and their clean/dirtystates. They show that this system may describe an acyclic graph, and if so, the operations in their protocol cannotturn that graph into a cyclic one. This guarantees that deadlock cannot occur. However, if the system is initializedto a perfectly symmetric state, like all philosophers holding their left side forks, then the graph is cyclic at the outset,and their solution cannot prevent a deadlock. Initializing the system so that philosophers with lower IDs have dirtyforks ensures the graph is initially acyclic.

9.3 Source code example

Below is an implementation of the resource hierarchy solution written in Python.import threading from time import sleep import os # Layout of the table (P = philosopher, f = fork): # P0 # f3 f0 #P3 P1 # f2 f1 # P2 # Number of philosophers at the table. There'll be the same number of forks. numPhilosophers= 4 # Lists to hold the philosophers and the forks. # Philosophers are threads while forks are locks. philosophers = []forks = [] class Philosopher(threading.Thread): def __init__(self, index): threading.Thread.__init__(self) self.index= index def run(self): # Left fork has same index as self.index. # Right fork has index smaller by 1, except for the firstphilosopher leftForkIndex = self.index rightForkIndex = (self.index - 1) if self.index != 0 else (numPhilosophers - 1)forkPair = ForkPair(leftForkIndex, rightForkIndex) # Eat forever while True: forkPair.pickUp() print(“Philosopher”,self.index, “eats.”) forkPair.putDown() class ForkPair: def __init__(self, leftForkIndex, rightForkIndex): # Orderforks by index if leftForkIndex < rightForkIndex: self.firstFork = forks[leftForkIndex] self.secondFork = forks[rightForkIndex]else: self.firstFork = forks[rightForkIndex] self.secondFork = forks[leftForkIndex] def pickUp(self): # Pick the forkwith lower index first self.firstFork.acquire() self.secondFork.acquire() def putDown(self): self.firstFork.release()self.secondFork.release() if __name__ == "__main__": # Create our philosophers and forks for i in range(0, numPhiloso-phers): philosophers.append(Philosopher(i)) forks.append(threading.Lock()) # All philosophers start eating for philoso-pher in philosophers: philosopher.start() # Allow CTRL + C to exit the program try: while True: sleep(0.1) except(KeyboardInterrupt, SystemExit): os._exit(0)

9.4 See also

• Cigarette smokers problem

• Producers-consumers problem

• Readers-writers problem

• Sleeping barber problem

9.5 References[1] Dijkstra, Edsger W. EWD-1000. E.W. Dijkstra Archive. Center for American History, University of Texas at Austin.

(original; transcription)

[2] J. Díaz; I. Ramos (1981). Formalization of Programming Concepts: International Colloquium, Peniscola, Spain, April 19–25, 1981. Proceedings. Birkhäuser. pp. 323 , 326. ISBN 978-3-540-10699-9.

[3] Hoare, C. A. R. (2004). “Communicating Sequential Processes” (PDF). usingcsp.com (originally published in 1985 byPrentice Hall International).

[4] Dijkstra, Edsger W. EWD-310. E.W. Dijkstra Archive. Center for American History, University of Texas at Austin.(original; transcription)

[5] Chandy, K.M.; Misra, J. (1984). The Drinking Philosophers Problem. ACM Transactions on Programming Languagesand Systems.

• Silberschatz, Abraham; Peterson, James L. (1988). Operating Systems Concepts. Addison-Wesley. ISBN 0-201-18760-4.

Page 36: Computational Problems

9.6. EXTERNAL LINKS 29

• Dijkstra, E. W. (1971, June). Hierarchical ordering of sequential processes. Acta Informatica 1(2): 115–138.

• Lehmann, D. J., Rabin M. O, (1981). On the Advantages of Free Choice: A Symmetric and Fully DistributedSolution to the Dining Philosophers Problem. Principles Of Programming Languages 1981 (POPL'81), pp.133–138.

9.6 External links• Illustration of the dining philosophers problem (Java applet) at the Wayback Machine (archived March 7, 2013)

• Discussion of the problem with solution code for 2 or 4 philosophers

• Discussion of various solutions at the Wayback Machine (archived December 8, 2013)

• Discussion of a solution using continuation based threads (cbthreads) at the Wayback Machine (archived March4, 2012)

• Distributed symmetric solutions

• Programming the Dining Philosophers with Simulation

• Interactive example of the Philosophers problem (Java required)

• Satan Comes to Dinner

• Wot No Chickens? - Peter H. Welch proposed the Starving Philosophers variant that demonstrates an unfor-tunate consequence of the behaviour of Java thread monitors is to make thread starvation more likely thanstrictly necessary.

• ThreadMentor

• Solving The Dining Philosophers Problem With Asynchronous Agents

• Solution using Actors

Page 37: Computational Problems

Chapter 10

Dutch national flag problem

For the article about the Dutch national flag, see Flag of the Netherlands.The Dutch national flag problem (DNF)[1] is a computer science programming problem proposed by Edsger

The Dutch national flag

Dijkstra.[2] The flag of the Netherlands consists of three colours: red, white and blue. Given balls of these threecolours arranged randomly in a line (the actual number of balls does not matter), the task is to arrange them such thatall balls of the same colour are together and their collective colour groups are in the correct order.The solution to this problem is of interest for designing sorting algorithms. In particular, variants of the quicksortalgorithm that must be robust to repeated elements need a three-way partitioning function that groups items less thana given key (red), equal to the key (white) and greater than the key (blue). Several solutions exist that have varyingperformance characteristics, tailored to sorting arrays with either small or large numbers of repeated elements.[3]

30

Page 38: Computational Problems

10.1. THE ARRAY CASE 31

10.1 The array case

This problem can also be viewed in terms of rearranging elements of an array. Suppose each of the possible elementscould be classified into exactly one of three categories (bottom, middle, and top). For example, if all elements arein 0 ... 1, the bottom could be defined as elements in 0 ... 0.1 (not including 0.1), the middle as 0.1 ... 0.3 (notincluding 0.3) and the top as 0.3 and greater. (The choice of these values illustrates that the categories need not beequal ranges). The problem is then to produce an array such that all “bottom” elements come before (have an indexless than the index of) all “middle” elements, which come before all “top” elements.One algorithm is to have the top group grow down from the top of the array, the bottom group grow up from thebottom, and keep the middle group just above the bottom. The algorithm indexes three locations, the bottom of thetop group, the top of the bottom group, and the top of the middle group. Elements that are yet to be sorted fallbetween the middle and the top group.[4] At each step, examine the element just above the middle. If it belongs tothe top group, swap it with the element just below the top. If it belongs in the bottom, swap it with the elementjust above the bottom. If it is in the middle, leave it. Update the appropriate index. Complexity is Θ(n) moves andexaminations.[1]

10.1.1 Pseudocode

The following pseudocode for three-way partitioning assumes zero-based array indexing. It uses three indices i, j andn, maintaining the invariant that i ≤ j.procedure three-way-partition(A : array of value, mid : value): i ← 0 j ← 0 n ← size of A - 1 while j ≤ n: if A[j]< mid: swap A[i] and A[j] i ← i + 1 j ← j + 1 else if A[j] > mid: swap A[j] and A[n] n ← n - 1 else: j ← j + 1

10.2 See also• American flag sort

10.3 References[1] “Dutch National Flag problem and algorithm”. Faculty of Information Technology (Clayton), Monash University, Australia.

1998.

[2] In a chapter of his book A Discipline of Programming Prentice-Hall, 1976

[3] The latter case occurs in string sorting with multi-key quicksort. Kim, Eunsang; Park, Kunsoo (2009). “Improvingmultikey Quicksort for sorting strings with many equal elements”. Information Processing Letters 109 (9): 454–459.doi:10.1016/j.ipl.2009.01.007.

[4] Black, Paul E. “Dutch national flag”. Dictionary of Algorithms and Data Structures. NIST.

10.4 External links• Explanation and interactive explanatory execution of the algorithm, sorting two or three colors

Page 39: Computational Problems

Chapter 11

Function problem

In computational complexity theory, a function problem is a computational problem where a single output (of a totalfunction) is expected for every input, but the output is more complex than that of a decision problem, that is, it isn'tjust YES or NO.

11.1 Formal definition

A functional problem P is defined as a relation R(x, y) over a cartesian product over strings of an arbitrary alphabetΣ :R ⊂ Σ∗ × Σ∗

An algorithm solves P if for every input x such that there exists a y satisfying (x, y) ∈ R , the algorithm producesone such y .

11.2 Examples

A well-known function problem is given by the Functional Boolean Satisfyability Problem, FSAT for short. Theproblem, which is closely related to the SAT decision problem can be formulated as follows:Given a boolean formula φ with variables x1, . . . , xn , find an assignment xi → TRUE,FALSE such that φevaluates to TRUE or decide that no such assignment exists.In this case the relation R(x, y) is given by tuples of suitably encoded boolean formulas and satisfying assignments.Other notable examples include the travelling salesman problem, which asks for the route taken by the salesman, andthe integer factorization problem, which asks for the list of factors.

11.3 Relationship to other complexity classes

Consider an arbitrary decision problem in the class NP. By definition each problem instance x which are answered'yes’ have a certificate y which servers as a proof for the 'yes’ answer. Thus, the set of these tuples (x, y) forms arelation. The complexity class derived from this transformation is denoted by F(NP) or FNP for short. The mappingof the complexity class P is denoted by FP. The class FP is the set of function problems which can be solved by adeterministic Turing machine in polynomial time, whereas FNP is the set of function problems which can be solvedby a non-deterministic Turing machine in polynomial time.

32

Page 40: Computational Problems

11.4. SELF-REDUCIBILITY 33

11.4 Self-reducibility

Observe that the problem FSAT introduced above can be solved using only polynomially many calls to a subroutinewhich decides the SAT problem: An algorithm can first ask whether the formula φ is satisfiable. After that thealgorithm can fix variable x1 to TRUE and ask again. If the resulting formula is still satisfiable the algorithm keepsx1 fixed to TRUE and continues to fix x2 , otherwise it decides that x1 has to be FALSE and continues. Thus, FSATis solvable in polynomial time using an oracle deciding SAT. In general, a problem inNP is called self-reducible if itsfunction variant can be solved in polynomial time using an oracle deciding the original problem. EveryNP-completeproblem is self-reducible. It is conjectured that the integer factorization problem is not self-reducible.

11.5 Reductions and complete problems

Function problems can be reduced much like decision problems: Given function problems ΠR and ΠS we say thatΠR reduces to ΠS if there exists polynomially-time computable functions f and g such that for all instances x of Rand possible solutions y of S , it holds that

• If x has an R -solution, then f(x) has an S -solution.

• (f(x), y) ∈ S =⇒ (x, g(x, y)) ∈ R.

It is therefore possible to define FNP-complete problems analogous to the NP-complete problem:A problem ΠR is FNP-complete if every problem in FNP can be reduced to ΠR . The complexity class of FNP-complete problems is denoted by FNP-C or FNPC. It coincides with F(NP) . Hence the problem FSAT is also anFNP-complete problem, and it holds that P = NP if and only if FP = FNP .

11.6 Total function problems

The relation R(x, y) used to define function problems has the drawback of being incomplete: Not every input x hasa counterpart y such that (x, y) ∈ R . Therefore the question of computability of proofs is not separated from thequestion of their existence. To overcome this problem it is convenient to consider the restriction of function problemsto total relations yielding the class TFNP as a subclass of FNP. This class contains problems such as the computationof pure Nash equilibria in certain strategic games where a solution is guaranteed to exist. It has been shown thatTFNP = F(NP∩ co-NP) . In addition, if TFNP contains any FNP-complete problem it follows that NP = co-NP.

11.7 References• Raymond Greenlaw, H. James Hoover, Fundamentals of the theory of computation: principles and practice,

Morgan Kaufmann, 1998, ISBN 1-55860-474-X, p. 45-51

• Elaine Rich, Automata, computability and complexity: theory and applications, Prentice Hall, 2008, ISBN0-13-228806-0, section 28.10 “The problem classes FP and FNP”, pp. 689-694

11.8 See also• Decision problem

• Search problem

• Counting problem (complexity)

• Optimization problem

Page 41: Computational Problems

Chapter 12

Gap reduction

In computational complexity theory, a gap reduction is a reduction to a particular type of decision problem, known asa c-gap problem. Such reductions provide information about the hardness of approximating solutions to optimizationproblems. In short, a gap problem refers to one wherein the objective is to distinguish between cases where thebest solution is above one threshold from cases where the best solution is below another threshold, such that thetwo thresholds have a gap in between. Gap reductions can be used to demonstrate inapproximability results, as if aproblem may be approximated to a better factor than the size of gap, then the approximation algorithm can be usedto solve the corresponding gap problem.

12.1 c-gap problem

We define a c-gap problem as follows:[1] given an optimization (maximization or minimization) problem P, theequivalent c-gap problem distinguishes between two cases, for an input k and an instance x of problem P:

OPTP (x) ≤ k

OPTP (x) > c · k

Note that whenever OPT falls between the thresholds, there is no requirement on what the output should be. A validalgorithm for the c-gap problem may answer anything if OPT is in the middle of the gap. The value c does not needto be constant; it can depend on the size of the instance of P. Note that c-approximating the solution to an instanceof P is at least as hard as solving the c-gap version of P.One can define an (a,b)-gap problem similarly. The difference is that the thresholds do not depend on the input;instead, the lower threshold is a and the upper threshold is b.

12.2 Gap-producing reduction

A gap-producing reduction is a reduction from an optimization problem to a c-gap problem, so that solving the c-gapproblem quickly would enable solving the optimization problem quickly. The term gap-producing arises from thenature of the reduction: the optimal solution in the optimization problem maps to the opposite side of the gap fromevery other solution via reduction. Thus, a gap is produced between the optimal solution and every other solution.A simple example of a gap-producing reduction is the nonmetric Traveling Salesman problem (i.e. where the graph’sedge costs need not satisfy the conditions of a metric). We can reduce from the Hamiltonian path problem on a givengraph G = (V, E) to this problem as follows: we construct a complete graph G' = (V, E'), for the traveling salesmanproblem. For each edge e ∈ G', we let the cost of traversing it be 1 if e is in the original graph G and ∞ otherwise.A Hamiltonian path in the original graph G exists if and only if there exists a traveling salesman solution with weight(|V|−1). However, if no such Hamiltonian path exists, then the best traveling salesman tour must have weight at least|V|. Thus, Hamiltonian Path reduces to |V|/(|V|−1)-gap nonmetric traveling salesman.

34

Page 42: Computational Problems

12.3. GAP-PRESERVING REDUCTION 35

12.3 Gap-preserving reduction

A gap-preserving reduction is a reduction from a c-gap problem to a c'-gap problem. More specifically, we are givenan instance x of a problem A with |x| = n and want to reduce it to an instance x' of a problem B with |x'| = n'. Agap-preserving reduction from A to B is a set of functions (k(n), k'(n'), c(n), c'(n')) such thatFor minimization problems:

OPTA(x) ≤ k ⇒ OPTB(x') ≤ k', andOPTA(x) ≥ c⋅k ⇒ OPTB(x') ≥ c'⋅k'

For maximization problems:

OPTA(x) ≥ k ⇒ OPTB(x') ≥ k', andOPTA(x) ≤ k/c ⇒ OPTB(x') ≤ k'/c'

If c' > c, then this is a gap-amplifying reduction.

12.4 Examples

12.4.1 Max E3SAT

This problem is a form of the Boolean satisfiability problem (SAT), where each clause contains three distinct literalsand we want to maximize the number of clauses satisfied.[1]

Håstad showed that the (1/2+ε, 1-ε)-gap version of a similar problem, MAX E3-X(N)OR-SAT, is NP-hard.[2] TheMAX E3-X(N)OR-SAT problem is a form of SAT where each clause is the XOR of three distinct literals, exactlyone of which is negated. We can reduce from MAX E3-X(N)OR-SAT to MAX E3SAT as follows:

A clause xᵢ ⊕ x ⊕ x = 0 is converted to (xᵢ ∨ x ∨ x ) ∧ (¬xᵢ ∨ ¬x ∨ x ) ∧ (¬xᵢ ∨ x ∨ ¬x ) ∧ (xᵢ ∨ ¬x ∨¬x )A clause xᵢ ⊕ x ⊕ x = 0 is converted to (¬xᵢ ∨ ¬x ∨ ¬x ) ∧ (¬xᵢ ∨ x ∨ x ) ∧ (xᵢ ∨ ¬x ∨ x ) ∧ (xᵢ ∨ x ∨¬x )

If a clause is not satisfied in the original instance of MAX E3-X(N)OR-SAT, then at most three of the four corre-sponding clauses in our MAX E3SAT instance can be satisfied. Using a gap argument, it follows that a YES instanceof the problem has at least a (1-ε) fraction of the clauses satisfied, while a NO instance of the problem has at mosta (1/2+ε)(1) + (1/2-ε)(3/4) = (7/8 + ε/4)-fraction of the clauses satisfied. Thus, it follows that (7/8 + ε, 1 - ε)-gapMAX E3SAT is NP-hard. Note that this bound is tight, as a random assignment of variables gives an expected 7/8fraction of satisfied clauses.

12.4.2 Label Cover

The label cover problem is defined as follows: given a bipartite graph G = (A∪B, E), with

A = A1 ∪ A2 ∪ ... ∪ A , |A| = n, and |Aᵢ| = n/kB = B1 ∪ B2 ∪ ... ∪ B , |B| = n, and |Bᵢ| = n/k

We define a “superedge” between Aᵢ and B if at least one edge exists from Aᵢ to B in G, and define the superedge tobe covered if at least one edge from Aᵢ to B is covered.In the max-rep version of the problem, we are allowed to choose one vertex from each Aᵢ and each Bᵢ, and we aim tomaximize the number of covered superedges. In the min-rep version, we are required to cover every superedge in thegraph, and want to minimize the number of vertices we choose. Manurangsi and Moshkovitz show that the (O(n1/4),1)-gap version of both problems is solvable in polynomial time.[3]

Page 43: Computational Problems

36 CHAPTER 12. GAP REDUCTION

12.5 See also• Approximation-preserving reduction

• Optimization problem

• Approximation algorithm

• PTAS reduction

12.6 References[1] Demaine, Erik (Fall 2014). “Algorithmic Lower Bounds: Fun with Hardness Proofs Lecture 12 Notes” (PDF).

[2] Johan, Hastad (July 2001). “Some Optimal Inapproximability Results”. J. ACM 48 (4). ACM.

[3] Manurangsi, Pasin; Moshkovitz, Dana (2013). “Improved Approximation Algorithms for Projection Games”. ESA 20138125. ESA. pp. 683–694.

Page 44: Computational Problems

Chapter 13

Josephus problem

In computer science and mathematics, the Josephus Problem (or Josephus permutation) is a theoretical problemrelated to a certain counting-out game.There are people standing in a circle waiting to be executed. The counting out begins at some point in the circleand proceeds around the circle in a fixed direction. In each step, a certain number of people are skipped and thenext person is executed. The elimination proceeds around the circle (which is becoming smaller and smaller as theexecuted people are removed), until only the last person remains, who is given freedom.The task is to choose the place in the initial circle so that you are the last one remaining and so survive.

13.1 History

The problem is named after Flavius Josephus, a Jewish historian living in the 1st century. According to Josephus’account of the siege of Yodfat, he and his 40 soldiers were trapped in a cave, the exit of which was blocked byRomans. They chose suicide over capture and decided that they would form a circle and start killing themselves usinga step of three. Josephus states that by luck or possibly by the hand of God, he and another man remained the lastand gave up to the Romans.The reference comes from Book 3, Chapter 8, par 7 of Josephus’ The Jewish War (writing of himself in the thirdperson):

However, in this extreme distress, he was not destitute of his usual sagacity; but trusting himself tothe providence of God, he put his life into hazard [in the manner following]: “And now,” said he, “sinceit is resolved among you that you will die, come on, let us commit our mutual deaths to determinationby lot. He whom the lot falls to first, let him be killed by him that hath the second lot, and thus fortuneshall make its progress through us all; nor shall any of us perish by his own right hand, for it would beunfair if, when the rest are gone, somebody should repent and save himself.” This proposal appeared tothem to be very just; and when he had prevailed with them to determine this matter by lots, he drewone of the lots for himself also. He who had the first lot laid his neck bare to him that had the next,as supposing that the general would die among them immediately; for they thought death, if Josephusmight but die with them, was sweeter than life; yet was he with another left to the last, whether we mustsay it happened so by chance, or whether by the providence of God. And as he was very desirous neitherto be condemned by the lot, nor, if he had been left to the last, to imbrue his right hand in the blood ofhis countrymen, he persuaded him to trust his fidelity to him, and to live as well as himself.[1]

13.2 Solution

In the following, n denotes the number of people in the initial circle, and k denotes the count for each step, that is,k − 1 people are skipped and the k -th is executed. The people in the circle are numbered from 1 to n .

37

Page 45: Computational Problems

38 CHAPTER 13. JOSEPHUS PROBLEM

13.2.1 k=2

We explicitly solve the problem when every 2nd person will be killed, i.e. k = 2 . (For the more general case k = 2 ,we outline a solution below.) We express the solution recursively. Let f(n) denote the position of the survivor whenthere are initially n people (and k = 2 ). The first time around the circle, all of the even-numbered people die. Thesecond time around the circle, the new 2nd person dies, then the new 4th person, etc.; it’s as though there were nofirst time around the circle.If the initial number of people was even, then the person in position x during the second time around the circle wasoriginally in position 2x − 1 (for every choice of x ). Let n = 2j . The person at f(j) who will now survive wasoriginally in position 2f(j)− 1 . This gives us the recurrence

f(2j) = 2f(j)− 1 .

If the initial number of people was odd, then we think of person 1 as dying at the end of the first time around thecircle. Again, during the second time around the circle, the new 2nd person dies, then the new 4th person, etc. Inthis case, the person in position x was originally in position 2x+ 1 . This gives us the recurrence

f(2j + 1) = 2f(j) + 1 .

When we tabulate the values of n and f(n) we see a pattern:This suggests that f(n) is an increasing odd sequence that restarts with f(n) = 1 whenever the index n is a powerof 2. Therefore, if we choose m and l so that n = 2m + l and 0 ≤ l < 2m , then f(n) = 2 · l + 1 . It is clear thatvalues in the table satisfy this equation. Or we can think that after l people are dead there are only 2m people and wego to the 2l + 1 th person. He must be the survivor. So f(n) = 2l + 1 . Below, we give a proof by induction.Theorem: If n = 2m + l and 0 ≤ l < 2m , then f(n) = 2l + 1 .Proof: We use strong induction on n . The base case n = 1 is true. We consider separately the cases when n is evenand when n is odd.If n is even, then choose l1 and m1 such that n/2 = 2m1 + l1 and 0 ≤ l1 < 2m1 . Note that l1 = l/2 . We havef(n) = 2f(n/2)−1 = 2((2l1)+1)−1 = 2l+1 , where the second equality follows from the induction hypothesis.If n is odd, then choose l1 and m1 such that (n − 1)/2 = 2m1 + l1 and 0 ≤ l1 < 2m1 . Note that l1 = (l − 1)/2. We have f(n) = 2f((n − 1)/2) + 1 = 2((2l1) + 1) + 1 = 2l + 1 , where the second equality follows from theinduction hypothesis. This completes the proof.We can solve for l to get an explicit expression for f(n) :

f(n) = 2(n− 2⌊log2(n)⌋) + 1

The most elegant form of the answer involves the binary representation of size n : f(n) can be obtained by a one-bit left cyclic shift of n itself. If we represent n in binary as n = 1b1b2b3 . . . bm , then the solution is given byf(n) = b1b2b3 . . . bm1 . The proof of this follows from the representation of n as 2m + l or from the aboveexpression for f(n) .

13.2.2 The general case

The easiest way to solve this problem in the general case is to use dynamic programming by performing the first stepand then using the solution of the remaining problem. When the index starts from one, then the person at s shiftsfrom the first person is in position ((s− 1)modn) + 1 , where n is the total number of persons. Let f(n, k) denotethe position of the survivor. After the k -th person is killed, we're left with a circle of n − 1 , and we start the nextcount with the person whose number in the original problem was (kmodn) + 1 . The position of the survivor in theremaining circle would be f(n−1, k) if we start counting at 1 ; shifting this to account for the fact that we're startingat (kmodn) + 1 yields the recurrence

f(n, k) = ((f(n− 1, k) + k − 1)modn) + 1, with f(1, k) = 1 ,

Page 46: Computational Problems

13.3. VARIANTS AND GENERALIZATIONS 39

which takes the simpler form

g(n, k) = (g(n− 1, k) + k)modn, with g(1, k) = 0

if we number the positions from 0 to n− 1 instead.This approach has running time O(n) , but for small k and large n there is another approach. The second approachalso uses dynamic programming but has running time O(k logn) . It is based on considering killing k-th, 2k-th, ...,(⌊n/k⌋k) -th people as one step, then changing the numbering.

13.3 Variants and generalizations

Josephus had an accomplice; the problem was then to find the places of the two last remaining survivors (whoseconspiracy would ensure their survival). It is alleged that he placed himself and the other man in the 31st and 16thplace respectively.[2] A generalization of this process is as follows. We suppose that everym th person will be executedfrom a group of size n , in which the p th person is the survivor. If there is an addition of x people to the circle, thenthe survivor is in the p + mx th position if there is less than or equal to n + x . If x is the lowest value in which(p+mx) > (n+ x) , then the survivor is in position (p+mx)− (n+ x) .[3]

13.3.1 Extended Josephus problem

Problem definition: There are n persons, numbered 1 to n, around a circle. We eliminate second of every tworemaining persons until one person remains. Given the n, determine the number of xth person who is eliminated.[4]

13.4 Notes[1] Flavius Josephus, Wars Of The Jews III. 8. 7. (Translation by William Whiston).

[2] Rouse Ball, W. W. (1896). Mathematical Recreations and Essays (2nd ed.). Macmillan. Retrieved 1 August 2015.

[3] Robinson, W. J. (1960). “The Josephus Problem”. The Mathematical Gazette 44 (347): 47–52. doi:10.2307/3608532.

[4] Armin Shams-Baragh Formulating The Extended Josephus Problem.

13.5 References• Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein (2001). “Chapter 14: Aug-

menting Data Structures”. Introduction to Algorithms (Second ed.). MIT Press and McGraw-Hill. p. 318.ISBN 0-262-03293-7.

13.6 External links• Josephus Flavius game (Java Applet) at cut-the-knot allowing selection of every nth out of 50 (maximum).

• Josephus Problem at the MathWorld encyclopedia

Page 47: Computational Problems

Chapter 14

Linear search problem

In computational complexity theory, the linear search problem is an optimal search problem introduced by RichardE. Bellman.[1] (independently considered by Anatole Beck [2][3][4]).

14.1 The problem

“An immobile hider is located on the real line according to a known probability distribution. A searcher, whosemaximal velocity is one, starts from the origin and wishes to discover the hider in minimal expected time. It isassumed that the searcher can change the direction of his motion without any loss of time. It is also assumed that thesearcher cannot see the hider until he actually reaches the point at which the hider is located and the time elapseduntil this moment is the duration of the game.” It is obvious that in order to find the hider the searcher has to go adistance x1 in one direction, return to the origin and go distance x2 in the other direction etc., (the length of the n-thstep being denoted by x ), and to do it in an optimal way. (However, an optimal solution need not have a first step andcould start with an infinite number of small 'oscillations’.) This problem is usually called the linear search problemand a search plan is called a trajectory. It has attracted much research, some of it quite recent.The linear search problem for a general probability distribution is unsolved.[5] However, there exists a dynamic pro-gramming algorithm that produces a solution for any discrete distribution [6] and also an approximate solution, forany probability distribution, with any desired accuracy.[7]

The linear search problem was solved by Anatole Beck and Donald J. Newman (1970) as a two-person zero-sum game.Their minimax trajectory is to double the distance on each step and the optimal strategy is a mixture of trajectoriesthat increase the distance by some fixed constant.[8] This solution gives search strategies that are not sensitive toassumptions concerning the distribution of the target. Thus, it also presents an upper bound for a worst-case scenario.This solution was obtained in the framework of an online algorithm by Shmuel Gal, who also generalized this resultto a set of concurrent rays.[9] The best online competitive ratio for the search on the line is 9 but it can be reduced to4.6 by using a randomized strategy. The online solution with a turn cost is given in.[10]

These results were rediscovered in the 1990s by computer scientists as the cow path problem.

14.2 See also

• Search games

14.3 References[1] R. Bellman. An optimal search problem, SIAM Rev. (1963).

[2] A. Beck. On the linear search Problem, Israel J. Mathematics (1964).

[3] A. Beck. More on the linear search problem, Israel J. Mathematics (1965).

40

Page 48: Computational Problems

14.3. REFERENCES 41

[4] A. Beck and M. Beck. The linear search problem rides again, Israel J. Mathematics (1986).

[5] Alpern, Steve; Gal, Shmuel (2003), “Chapter 8. Search on the Infinite Line”, The Theory of Search Games and Rendezvous,Part 2, International Series in Operations Research & Management Science 55, pp. 123–144, doi:10.1007/0-306-48212-6_8. On p. 124, Alpern and Gal write “no algorithm for solving the problem for a general probability distribution functionhas been found during about 37 years since the LSP was first presented.”

[6] T.F. Bruss and J.B. Robertson. A survey of the linear-search problem. Math. Sci. 13 (1988).

[7] S. Alpern and S. Gal. The Theory of Search Games and Rendezvous. Springer (2003): 139-−143.

[8] A. Beck and D.J. Newman. Yet More on the linear search problem. Israel J. Math. (1970).

[9] S. Gal. SEARCH GAMES, Academic Press (1980).

[10] E. Demaine, S. Fekete and S. Gal. Online searching with turn cost. Theoretical Computer Science (2006).

Page 49: Computational Problems

Chapter 15

List of PPAD-complete problems

This is a list of PPAD-complete problems.

15.1 Fixed Point Theorems

• Sperner’s Lemma

• Brouwer fixed point theorem

• Kakutani fixed point theorem

15.2 Topology

• Tucker’s Lemma

• Borsuk–Ulam theorem

15.3 Game Theory and Nash Equilibrium

• 3-Graphical Nash

• 4-Nash

• 3-Nash

• 2-Nash

• 2-Player win-lose games

15.4 Economics and Market Equilibria

• Exchange Economy

• Leontief exchange economy

• Arrow-Debreu Equilibria

42

Page 50: Computational Problems

15.5. SCARF’S LEMMA AND FRACTIONAL STABILITY 43

15.5 Scarf’s Lemma and Fractional Stability• Scarf’s Lemma

• Core of Balanced Games

• Fractional Stable Paths Problems

• Hypergraph matching

• Strong Fractional Kernel

• Preference Games

15.6 Miscellaneous• Personalized Equilibria

• Fractional Bounded Budget Connection Games

15.7 References• Papadimitriou, Christos (1994). “On the Complexity of the Parity Argument and Other Inefficient Proofs of

Existence.”. Journal of Computer and System Sciences 48 (3): 498–532. doi:10.1016/S0022-0000(05)80063-7. Paper available online at Papadimitriou’s Homepage.

• C. Daskalakis, P.W. Goldberg and C.H. Papadimitriou (2009). “The Complexity of Computing a Nash Equi-librium”. SIAM Journal on Computing 39 (3): 195–259. doi:10.1137/070699652.

• Xi Chen and Xiaotie Deng (2006). Settling the complexity of two-player Nash equilibrium. pp. 261–272.

15.8 External links• Compendium of PPAD-complete Problems

Page 51: Computational Problems

Chapter 16

n-body problem

This article is about the problem in classical mechanics. For the problem in quantum mechanics, see Many-body prob-lem. For engineering problems and simulations involving many components, see Multibody system and Multibodysimulation.

In physics, the n-body problem is the problem of predicting the individual motions of a group of celestial objectsinteracting with each other gravitationally.[1] Solving this problem has been motivated by the desire to understand themotions of the Sun, Moon, planets and the visible stars. In the 20th century, understanding the dynamics of globularcluster star systems became an important n-body problem.[2] The n-body problem in general relativity is considerablymore difficult to solve.The classical physical problem can be informally stated as: given the quasi-steady orbital properties (instantaneousposition, velocity and time)[3] of a group of celestial bodies, predict their interactive forces; and consequently, predicttheir true orbital motions for all future times.[4]

To this purpose the two-body problem has been completely solved and is discussed below; as is the famous restricted3-Body Problem.[5]

16.1 History

Knowing three orbital positions of a planet’s orbit – positions obtained by Sir Isaac Newton (1643-1727) from as-tronomer John Flamsteed[6] – Newton was able to produce an equation by straightforward analytical geometry, topredict a planet’s motion; i.e., to give its orbital properties: position, orbital diameter, period and orbital velocity.[7]

Having done so he and others soon discovered over the course of a few years, those equations of motion did not pre-dict some orbits very well or even correctly.[8] Newton realized it was because gravitational interactive forces amongstall the planets was affecting all their orbits.The above discovery goes right to the heart of the matter as to what exactly the n-body problem is physically: asNewton realized, it is not sufficient to just specify the initial position and velocity, or three orbital positions either, todetermine a planet’s true orbit: the gravitational interactive forces have to be known too. Thus came the awareness andrise of the n-body “problem” in the early 17th century. These gravitational attractive forces do conform to Newton’sLaws of Motion and to his Law of Universal Gravitation, but the many multiple (n-body) interactions have historicallymade any exact solution intractable. Ironically, this conformity led to the wrong approach.After Newton’s time the n-body problem historically was not stated correctly because it did not include a reference tothose gravitational interactive forces. Newton does not say it directly but implies in his Principia the n-body problemis unsolvable because of those gravitational interactive forces.[9] Newton said[10] in his Principia, paragraph 21:

And hence it is that the attractive force is found in both bodies. The Sun attracts Jupiter and theother planets, Jupiter attracts its satellites and similarly the satellites act on one another. And althoughthe actions of each of a pair of planets on the other can be distinguished from each other and can beconsidered as two actions by which each attracts the other, yet inasmuch as they are between the same,two bodies they are not two but a simple operation between two termini. Two bodies can be drawn toeach other by the contraction of rope between them. The cause of the action is twofold, namely the

44

Page 52: Computational Problems

16.2. GENERAL FORMULATION 45

disposition of each of the two bodies; the action is likewise twofold, insofar as it is upon two bodies; butinsofar as it is between two bodies it is single and one ...

Newton concluded via his 3rd Law that “according to this Law all bodies must attract each other.” This last statement,which implies the existence of gravitational interactive forces, is key.As shown below, the problem also conforms to Jean Le Rond D'Alembert's non-Newtonian 1st and 2nd Principlesand to the nonlinear n-body problem algorithm, the latter allowing for a closed form solution for calculating thoseinteractive forces.The problem of finding the general solution of the n-body problem was considered very important and challenging.Indeed in the late 19th century King Oscar II of Sweden, advised by Gösta Mittag-Leffler, established a prize foranyone who could find the solution to the problem. The announcement was quite specific:

Given a system of arbitrarily many mass points that attract each according to Newton’s law, underthe assumption that no two points ever collide, try to find a representation of the coordinates of eachpoint as a series in a variable that is some known function of time and for all of whose values the seriesconverges uniformly.

In case the problem could not be solved, any other important contribution to classical mechanics would then beconsidered to be prize-worthy. The prize was awarded to Poincaré, even though he did not solve the original problem.(The first version of his contribution even contained a serious error[11]). The version finally printed contained manyimportant ideas which led to the development of chaos theory. The problem as stated originally was finally solved byKarl Fritiof Sundman for n = 3.

16.2 General formulation

The n-body problem considersN point massesmi, i = 1, 2, . . . , N in an inertial reference frame in three dimensionalspace R3 moving under the influence of mutual gravitational attraction. Each mass mi has a position vector qi .Newton’s second law says that mass times acceleration mid

2qi/dt2 is equal to the sum of the forces on the mass.Newton’s law of gravity says that the gravitational force felt on mass mi by a single mass mj is given by[12]

Fij =Gmimj(qj − qi)

∥qj − qi∥3,

where G is the gravitational constant and ∥qj − qi∥ is the magnitude of the distance between qi and qj .Summing over all masses yields the n-body equations of motion:

mid2qidt2

=N∑

j=1,j =i

Gmimj(qj − qi)∥qj − qi∥3

=∂U

∂qi

where U is the self-potential energy

U =∑

1≤i<j≤N

Gmimj

∥qj − qi∥.

Defining the momentum to be pi = midqi/dt , Hamilton’s equations of motion for the n-body problem become[13]

dqidt

=∂H

∂pidpidt

= −∂H

∂qi,

where the Hamiltonian function is

Page 53: Computational Problems

46 CHAPTER 16. N-BODY PROBLEM

H = T + U

and T is the kinetic energy

T =

N∑i=1

∥pi∥2

2mi.

Hamilton’s equations show that the n-body problem is a system of 6N first-order differential equations, with 6N initialconditions as 3N initial position coordinates and 3N initial momentum values.Symmetries in the n-body problem yield global integrals of motion that simplify the problem.[14] Translational sym-metry of the problem results in the center of mass

C =

∑Ni=1 miqi∑Ni=1 mi

moving with constant velocity, so thatC = L0t+C0 , whereL0 is the linear momentum andC0 is the initial position.The constants of motion L0 and C0 represent six integrals of the motion. Rotational symmetry results in the totalangular momentum being constant

A =N∑i=1

qi × pi,

where × is the cross product. The three components of the total angular momentum A yield three more constants ofthe motion. The last general constant of the motion is given by the conservation of energy H . Hence, every n-bodyproblem has ten integrals of motion.Because T and U are homogeneous functions of degree 2 and −1, respectively, the equations of motion have a scalinginvariance: if qi(t) is a solution, then so is λ−2/3qi(λt) for any λ > 0 .[15]

The moment of inertia of an n-body system is given by

I =N∑i=1

miqi · qi =N∑i=1

mi∥qi∥2

and the virial is given by Q = (1/2)dI/dt . Then the Lagrange-Jacobi formula states that[16]

d2I

dt2= 2T − U.

For systems in dynamic equilibrium, the long-term time average of ⟨d2I/dt2⟩ is zero. Then on average the total kineticenergy is half the total potential energy, ⟨T ⟩ = ⟨U⟩/2 , which is an example of the virial theorem for gravitationalsystems.[17] If M is the total mass and R a characteristic size of the system (for example, the radius containing half themass of the system), then the critical time for a system to settle down to a dynamic equilibrium is tcr =

√GM/R3

.[18]

16.3 Special cases

16.3.1 Two-body problem

Main article: Two-body problem

Page 54: Computational Problems

16.3. SPECIAL CASES 47

Any discussion of planetary interactive forces has always started historically with the two-body problem. The purposeof this Section is to relate the real complexity in calculating any planetary forces. Note in this Section also, severalsubjects, such as gravity, barycenter, Kepler’s Laws, etc.; and in the following Section too (Three-body problem) arediscussed on other Wikipedia pages. Here though, these subjects are discussed from the perspective of the n-bodyproblem.The two-body problem (N = 2) was completely solved by Johann Bernoulli (1667-1748) by classical theory (andnot by Newton) by assuming the main point-mass was fixed, is outlined here.[19] Consider then the motion of twobodies, say Sun-Earth, with the Sun fixed, then:

m1a1 =Gm1m2

r312(r2 − r1) Sun-Earth

m2a2 =Gm1m2

r321(r1 − r2) Earth-Sun

The equation describing the motion of mass m2 relative to mass m1 is readily obtained from the differences betweenthese two equations and after canceling common terms gives: α+ (η/r3)r = 0 , where

• r = r2 − r1 is the vector position of m2 relative to m1 ;

• α is the Eulerian acceleration d2r/dt2 ;

• and η = G(m1 +m2) .

The equation α + (η/r3)r = 0 is the fundamental differential equation for the two-body problem Bernoulli solvedin 1734. Notice for this approach forces have to be determined first, then the equation of motion resolved. Thisdifferential equation has elliptic, or parabolic or hyperbolic solutions[20], [21],.[22]

It is incorrect to think of m1 (the Sun) as fixed in space when applying Newton’s Law of Universal Gravitation,and to do so leads to erroneous results. The fixed point for two isolated gravitationally interacting bodies is theirmutual barycenter, and this two-body problem can be solved exactly, such as using Jacobi coordinates relative to thebarycenter.Dr. Clarence Cleminshaw calculated the approximate position of the Solar System’s barycenter, a result achievedmainly by combining only the masses of Jupiter and the Sun. Science Program stated in reference to his work:

"The Sun contains 98 per cent of the mass in the solar system, with the superior planets beyond Marsaccounting for most of the rest. On the average, the center of the mass of the Sun-Jupiter system, when thetwo most massive objects are considered alone, lies 462,000 miles from the Sun’s center, or some 30,000miles above the solar surface! Other large planets also influence the center of mass of the solar system,however. In 1951, for example, the systems’ center of mass was not far from the Sun’s center becauseJupiter was on the opposite side from Saturn, Uranus and Neptune. In the late 1950s, when all four ofthese planets were on the same side of the Sun, the system’s center of mass was more than 330,000 milesfrom the solar surface, Dr. C. H. Cleminshaw of Griffith Observatory in Los Angeles has calculated.”[23]

The Sun wobbles as it rotates around the galactic center, dragging the Solar System and Earth along with it. Whatmathematician Kepler did in arriving at his three famous equations was curve-fit the apparent motions of the planetsusing Tycho Brahe's data, and not curve-fitting their true circular motions about the Sun (see Figure). Both RobertHooke and Newton were well aware that Newton’s Law of Universal Gravitation did not hold for the forces associatedwith elliptical orbits.[10] In fact, Newton’s Universal Law does not account for the orbit of Mercury, the asteroid belt’sgravitational behavior, or Saturn’s rings.[24] Newton stated (in the 11th Section of the Principia) that the main reason,however, for failing to predict the forces for elliptical orbits was that his math model was for a body confined to asituation that hardly existed in the real world, namely, the motions of bodies attracted toward an unmoving center.Some present physics and astronomy textbooks don't emphasize the negative significance of Newton’s assumptionand end up teaching that his math model is in effect reality. It is to be understood that the classical two-body problemsolution above is a mathematical idealization. See also Kepler’s first law of planetary motion.Some modern writers have criticized Newton’s fixed Sun as emblematic of a school of reductive thought - see Trues-dell’s Essays in the History of Mechanics referenced below. An aside: Newtonian physics doesn't include (amongother things) relative motion and may be the root of the reason Newton "fixed" the Sun.[25][26]

Page 55: Computational Problems

48 CHAPTER 16. N-BODY PROBLEM

The Real Motion v.s. Kepler’s Apparent Motion

16.3.2 Three-body problem

Main article: Three-body problem

This section relates an historically important n-body problem solution after simplifying assumptions were made.In the past not much was known about the n-body problem for n equal to or greater than three.[27] The case for n =3 has been the most studied. Many earlier attempts to understand the Three-body problem were quantitative, aimingat finding explicit solutions for special situations.

• In 1687 Isaac Newton published in the Principia the first steps in the study of the problem of the movements

Page 56: Computational Problems

16.3. SPECIAL CASES 49

of three bodies subject to their mutual gravitational attractions, but his efforts resulted in verbal descriptionsand geometrical sketches; see especially Book 1, Proposition 66 and its corollaries (Newton, 1687 and 1999(transl.), see also Tisserand, 1894).

• In 1767 Euler found collinear motions, in which three bodies of any masses move proportionately along a fixedstraight line. The circular restricted three-body problem is the special case in which two of the bodies are incircular orbits (approximated by the Sun-Earth-Moon system and many others).

• In 1772 Lagrange discovered two classes of periodic solution, each for three bodies of any masses. In oneclass, the bodies lie on a rotating straight line. In the other class, the bodies lie at the vertices of a rotatingequilateral triangle. In either case, the paths of the bodies will be conic sections. Those solutions led to thestudy of central configurations , for which q = kq for some constant k>0 .

• A major study of the Earth-Moon-Sun system was undertaken by Charles-Eugène Delaunay, who published twovolumes on the topic, each of 900 pages in length, in 1860 and 1867. Among many other accomplishments,the work already hints at chaos, and clearly demonstrates the problem of so-called "small denominators" inperturbation theory.

• In 1917 Forest Ray Moulton published his now classic, An Introduction to Celestial Mechanics (see references)with its plot of the Restricted Three-body Problem solution (see figure below).[28] An aside, see Meirovitch’sbook, pages 414 and 413 for his Restricted Three-body Problem solution.[29]

Motion of three particles under gravity, demonstrating chaotic behaviour

Page 57: Computational Problems

50 CHAPTER 16. N-BODY PROBLEM

Moulton’s solution may be easier to visualize (and definitely easier to solve) if one considers the more massive body(e.g., Sun) to be "stationary" in space, and the less massive body (e.g., Jupiter) to orbit around it, with the equilibriumpoints (Lagrangian points) maintaining the 60-degree spacing ahead of, and behind, the less massive body almostin its orbit (although in reality neither of the bodies are truly stationary, as they both orbit the center of mass of thewhole system—about the barycenter). For sufficiently small mass ratio of the primaries, these triangular equilibriumpoints are stable, such that (nearly) massless particles will orbit about these points as they orbit around the largerprimary (Sun). The five equilibrium points of the circular problem are known as the Lagrangian points. See figurebelow:

Restricted 3-Body Problem

In the Restricted 3-Body Problem math model figure above (ref. Moulton), the Lagrangian points L4 and L5 are wherethe Trojan planetoids resided (see Lagrangian point); m1 is the Sun and m2 is Jupiter. L2 is where the asteroid beltis. It has to be realized for this model, this whole Sun-Jupiter diagram is rotating about its barycenter. The Restricted3-Body Problem solution predicted the Trojan planetoids before they were first seen. The h-circles and closed loopsecho the electromagnetic fluxes issued from the Sun and Jupiter. It is conjectured, contrary to Richard H. Batin’sconjecture (see References), the two h1's are gravity sinks, in and where gravitational forces are zero, and the reasonthe Trojan planetoids are trapped there. The total amount of mass of the planetoids is unknown.The Restricted Three-body Problem assumes the mass of one of the bodies is negligible. For a discussion of the casewhere the negligible body is a satellite of the body of lesser mass, see Hill sphere; for binary systems, see Roche lobe.Specific solutions to the Three-body problem result in chaotic motion with no obvious sign of a repetitious path.The restricted problem (both circular and elliptical) was worked on extensively by many famous mathematicians andphysicists, most notably by Poincaré at the end of the 19th century. Poincaré's work on the Restricted Three-body

Page 58: Computational Problems

16.4. ANALYTIC APPROACHES 51

Problem was the foundation of deterministic chaos theory. In the restricted problem, there exist five equilibriumpoints. Three are collinear with the masses (in the rotating frame) and are unstable. The remaining two are locatedon the third vertex of both equilateral triangles of which the two bodies are the first and second vertices.

16.3.3 Planetary problem

The planetary problem is the n-body problem in the case that one of the masses is much larger than all the others. Aprototypical example of a planetary problem is the Sun-Jupiter-Saturn system, where the mass of the Sun is about 1000times bigger than the masses of Jupiter or Saturn.[15] An approximate solution to the problem is to decompose it intoN − 1 pairs of star-planet Kepler problems, treating interactions among the planets as perturbations. Perturbativeapproximation works well as long as there are no orbital resonances in the system, that is none of the ratios ofunperturbed Kepler frequencies is a rational number. Resonances appear as small denominators in the expansion.The existence of resonances and small denominators led to the important question of stability in the planetary problem:do planets, in nearly circular orbits around a star, remain in stable or bounded orbits over time?[15][30] In 1963,Vladimir Arnold proved using KAM theory a kind of stability of the planetary problem: there exists a set of positivemeasure of quasiperiodic orbits in the case of the planetary problem restricted to the plane.[30] In the KAM theory,chaotic planetary orbits would be bounded by quasiperiodic KAM tori. Arnold’s result was extended to a more generaltheorem by Féjoz and Herman in 2004.[31]

16.3.4 Central configurations

A central configuration q1(0), . . . , qN (0) is an initial configuration such that if the particles were all released withzero velocity, they would all collapse toward the center of mass C .[30] Such a motion is called homothetic. Centralconfigurations may also give rise to homographic motions in which all masses moves along Keplerian trajectories(elliptical, circular, parabolic, or hyperbolic), with all trajectories having the same eccentricity e . For ellipticaltrajectories, e = 1 corresponds to homothetic motion and e = 0 gives a relative equilibrium motion in which theconfiguration remains an isometry of the initial configuration, as if the configuration was a rigid body.[32] Centralconfigurations have played an important role in understanding the topology of invariant manifolds created by fixingthe first integrals of a system.

16.3.5 n-body choreography

Main article: n-body choreography

Solutions in which all masses move on the same curve without collisions are called choreographies.[33] A choreographyfor N = 3 was discovered by Lagrange in 1772 in which three bodies are situated at the vertices of an equilateraltriangle in the rotating frame. A figure eight choreography for N = 3 was found numerically by C. Moore in 1993and generalized and proven by A. Chenciner and R. Montgomery in 2000. Since then, many other choreographieshave been found for N ≥ 3 .

16.4 Analytic approaches

For every solution of the problem, not only applying an isometry or a time shift but also a reversal of time (unlike inthe case of friction) gives a solution as well.In the physical literature about the n -body problem ( n ≥ 3), sometimes reference is made to the impossibility ofsolving the n -body problem (via employing the above approach). However, care must be taken when discussingthe 'impossibility' of a solution, as this refers only to the method of first integrals (compare the theorems by Abeland Galois about the impossibility of solving algebraic equations of degree five or higher by means of formulas onlyinvolving roots).

Page 59: Computational Problems

52 CHAPTER 16. N-BODY PROBLEM

16.4.1 Power series solution

One way of solving the classical n-body problem is “the n-body problem by Taylor series", which is an implementationof the Power series solution of differential equations.We start by defining the system of differential equations:

d2xi(t)dt2 = G

∑nk=1,k =i

mk(xk(t)−xi(t))|xk(t)−xi(t)|3 ,

As xi (t = t0) and dxi(t)/dtt₌t₀ are given as initial conditions, every d2xi(t)/dt2 are known. Differentiating d2xi(t)/dt2results in d3xi(t)/dt3 which at t0 which is also known, and the Taylor series is constructed iteratively.

16.4.2 A generalized Sundman global solution

In order to generalize Sundman’s result for the case n > 3 (or n = 3 and c = 0) one has to face two obstacles:

1. As it has been shown by Siegel, collisions which involve more than two bodies cannot be regularized analytically,hence Sundman’s regularization cannot be generalized.

2. The structure of singularities is more complicated in this case: other types of singularities may occur (seebelow).

Lastly, Sundman’s result was generalized to the case of n > 3 bodies by Q. Wang in the 1990s. Since the structure ofsingularities is more complicated, Wang had to leave out completely the questions of singularities. The central pointof his approach is to transform, in an appropriate manner, the equations to a new system, such that the interval ofexistence for the solutions of this new system is [0,∞) .

16.4.3 Singularities of the n-body problem

There can be two types of singularities of the n-body problem:

• collisions of two or more bodies, but for which q(t) (the bodies’ positions) remains finite. (In this mathematicalsense, a “collision” means that two point-like bodies have identical positions in space.)

• singularities in which a collision does not occur, but q(t) does not remain finite. In this scenario, bodies divergeto infinity in a finite time, while at the same time tending towards zero separation (an imaginary collision occurs“at infinity”).

The latter ones are called Painlevé's conjecture (no-collisions singularities). Their existence has been conjectured forn > 3 by Painlevé (see Painlevé conjecture). Examples of this behavior for n=5 have been constructed by Xia[34] anda heuristic model for n=4 by Gerver.[35] Donald G. Saari has shown that singularities have measure zero for manycases.[36]

16.5 Simulation

Main article: N-body simulation

While there are analytic solutions available for the classical (ie. non-relativistic) two-body problem and for selectedconfigurations with N > 2 , in general n-body problems must be solved or simulated using numerical methods.[18]

16.5.1 Few bodies

For a small number of bodies, an n-body problem can be solved using direct methods, also called particle-particlemethods. These methods numerically integrate the differential equations of motion. Numerical integration for this

Page 60: Computational Problems

16.5. SIMULATION 53

problem can be a challenge for several reasons. First, the gravitational potential is singular; it goes to infinity as thedistance between two particles goes to zero. The gravitational potential may be softened to remove the singularity atsmall distances:[18]

Uϵ =∑

1≤i<j≤N

Gmimj(∥qj − qi∥2 + ϵ

)1/2 .Second, in general for N > 2, the N-body problem is chaotic,[37] which means that even small errors in integrationmay grow exponentially in time. Third, a simulation may be over large stretches of model time (e.g., millions ofyears) and numerical errors accumulate as integration time increases.There are a number of techniques to reduce errors in numerical integration.[18] Local coordinate systems are used todeal with widely differing scales in some problems, for example an Earth-Moon coordinate system in the context of asolar system simulation. Variational methods and perturbation theory can yield approximate analytic trajectories uponwhich the numerical integration can be a correction. The use of a symplectic integrator ensures that the simulationobeys Hamilton’s equations to a high degree of accuracy and in particular that energy is conserved.

16.5.2 Many bodies

Direct methods using numerical integration require on the order of N2/2 computations to evaluate the potentialenergy over all pairs of particles, and thus have a time complexity of O(N2) . For simulations with many particles,the O(N2) factor makes large-scale calculations especially time consuming.[18]

A number of approximate methods have been developed that reduce the time complexity relative to direct methods:[18]

• Tree code methods, such as a Barnes-Hut simulation, are collisionless methods used when close encountersamong pairs are not important and distant particle contributions do not need to be computed to high accuracy.The potential of a distant group of particles is computed using a multipole expansion of the potential. Thisapproximation allows for a reduction in complexity to O(N log(N)) .

• Fast multipole methods take advantage of the fact that the multipole-expanded forces from distant particlesare similar for particles close to each other. It is claimed that this further approximation reduces the complexityto O(N) .[18]

• Particle mesh methods divide up simulation space into a three dimensional grid onto which the mass densityof the particles is interpolated. Then calculating the potential becomes a matter of solving a Poisson equationon the grid, which can be computed in O(N log(N)) time using fast Fourier transform techniques. Usingadaptive mesh refinement or multigrid techniques can further reduce the complexity of the methods.

• P3M and PM-Tree methods are hybrid methods that use the particle mesh approximation for distant parti-cles, but use more accurate methods for close particles (within a few grid intervals). P3M stands for P 3Mor Particle-Particle-Particle-Mesh and uses direct methods with softened potentials at close range. PM-Treemethods instead use tree codes at close range. As with particle mesh methods, adaptive meshes can increasecomputational efficiency.

• Mean field methods approximate the system of particles with a time-dependent Boltzmann equation repre-senting the mass density that is coupled to a self-consistent Poisson equation representing the potential. It is atype of smoothed-particle hydrodynamics approximation suitable for large systems.

16.5.3 Strong gravitation

In astrophysical systems with strong gravitational fields, such as those near the event horizon of a black hole, n-body simulations must take into account general relativity; such simulations are the domain of numerical relativity.Numerically simulating the Einstein field equations is extremely challenging[18] and a parameterized post-Newtonianformalism (PPN), such as the Einstein–Infeld–Hoffmann equations, is used if possible. The two-body problem ingeneral relativity is analytically solvable only for the Kepler problem, in which one mass is assumed to be much largerthan the other.[38]

Page 61: Computational Problems

54 CHAPTER 16. N-BODY PROBLEM

16.6 Other n-body problems

Most work done on the n-body problem has been on the gravitational problem. But there exist other systems forwhich n-body mathematics and simulation techniques have proven useful.In large scale electrostatics problems, such as the simulation of proteins and cellular assemblies in structural biology,the Coulomb potential has the same form as the gravitational potential, except that charges may be positive or nega-tive, leading to repulsive as well as attractive forces.[39] Fast Coulomb solvers are the electrostatic counterpart to fastmultipole method simulators. These are often used with periodic boundary conditions on the region simulated andEwald summation techniques are used to speed up computations.[40]

In statistics and machine learning, some models have loss functions of a form similar to that of the gravitationalpotential: a sum of kernel functions over all pairs of objects, where the kernel function depends on the distancebetween the objects in parameter space.[41] Example problems that fit into this form include all-nearest-neighbors inmanifold learning, kernel density estimation, and kernel machines. Alternative optimizations to reduce the O(N2)time complexity toO(N) have been developed, such as dual tree algorithms, that have applicability to the gravitationaln-body problem as well.

16.7 See also

• Celestial mechanics

• Gravitational two-body problem

• Jacobi integral

• Lunar theory

• Natural units

• Numerical model of the Solar System

• Stability of the Solar System

16.8 Notes[1] Leimanis and Minorsky: Our interest is with Leimanis, who first discusses some history about the n-body problem, espe-

cially Ms. Kovalevskaya’s ~1868-1888, twenty-year complex-variables approach, failure; Section 1: The Dynamics ofRigid Bodies andMathematical Exterior Ballistics (Chapter 1, the motion of a rigid body about a fixed point (Euler andPoisson equations); Chapter 2, Mathematical Exterior Ballistics), good precursor background to the n-body problem; Sec-tion 2: CelestialMechanics (Chapter 1, The Uniformization of the Three-body Problem (Restricted Three-body Problem);Chapter 2, Capture in the Three-Body Problem; Chapter 3, Generalized n-body Problem).

[2] See references cited for Heggie and Hut.

[3] Quasi-steady loads refers to the instantaneous inertial loads generated by instantaneous angular velocities and accelerations,as well as translational accelerations (9 variables). It is as though one took a photograph, which also recorded the instan-taneous position and properties of motion. In contrast, a steady-state condition refers to a system’s state being invariant totime; otherwise, the first derivatives and all higher derivatives are zero.

[4] R. M. Rosenberg states the n-body problem similarly (see References): Each particle in a system of a finite number ofparticles is subjected to a Newtonian gravitational attraction from all the other particles, and to no other forces. If the initialstate of the system is given, how will the particles move? Rosenberg failed to realize, like everyone else, that it is necessaryto determine the forces first before the motions can be determined.

[5] A general, classical solution in terms of first integrals is known to be impossible. An exact theoretical solution for arbitraryn can be approximated via Taylor series, but in practice such an infinite series must be truncated, giving at best only anapproximate solution; and an approach now obsolete. In addition, the n-body problem may be solved using numericalintegration, but these, too, are approximate solutions; and again obsolete. See Sverre J. Aarseth’s book GravitationalN-body Simulations listed in the References.

Page 62: Computational Problems

16.8. NOTES 55

[6] See David H. and Stephen P. H. Clark’s The Suppressed Scientific Discoveries of Stephen Gray and John Flamsteed,Newton’s Tyranny, W. H. Freeman and Co., 2001. A popularization of the historical events and bickering between thoseparties, but more importantly about the results they produced.

[7] See "Discovery of gravitation, A.D. 1666" by Sir David Brewster, in The Great Events by Famous Historians, RossiterJohnson, LL.D. Editor-in-Chief, Volume XII, pp. 51-65, The National Alumni, 1905.

[8] Rudolf Kurth has an extensive discussion in his book (see References) on planetary perturbations. An aside: these math-ematically undefined planetary perturbations (wobbles) still exist undefined even today and planetary orbits have to beconstantly updated, usually yearly. See Astronomical Ephemeris and the American Ephemeris and Nautical Almanac,prepared jointly by the Nautical Almanac Offices of the United Kingdom and the United States of America.

[9] See Principia, Book Three, System of the World, "General Scholium,” page 372, last paragraph. Newton was well awarehis math model did not reflect physical reality. This edition referenced is from the Great Books of the Western World,Volume 34, which was translated by Andrew Motte and revised by Florian Cajori. This same paragraph is on page 1160 inStephen Hawkins' huge On the Shoulders of Giants, 2002 edition; is a copy from Daniel Adee’s 1848 addition. Cohenalso has translated new editions: Introduction to Newton’s 'Principia' , 1970; and Isaac Newton’s Principia, withVarian Readings, 1972. Cajori also wrote a History of Science, which is on the Internet.

[10] See. I. Bernard Cohen’s Scientific American article.

[11] for details of the serious error in Poincare’s first submission see the article by Diacu

[12] Meyer 2009, pp. 27-28

[13] Meyer 2009, p. 28

[14] Meyer 2009, pp. 28-29

[15] Chenciner 2007

[16] Meyer 2009, p. 34

[17] “AST1100 Lecture Notes: 5 The virial theorem” (PDF). University of Oslo. Retrieved 25 March 2014.

[18] Trenti 2008

[19] See Bate, Mueller, and White: Chapter 1, "Two-Body Orbital Mechanics,” pp 1-49. These authors were from the Dept.of Astronautics and Computer Science, United States Air Force Academy. See Chapter 1. Their textbook is not filled withadvanced mathematics.

[20] For the classical approach, if the common center of mass (i.e., the barycenter) of the two bodies is considered to be at rest,then each body travels along a conic section which has a focus at the barycenter of the system. In the case of a hyperbolait has the branch at the side of that focus. The two conics will be in the same plane. The type of conic (circle, ellipse,parabola or hyperbola) is determined by finding the sum of the combined kinetic energy of two bodies and the potentialenergy when the bodies are far apart. (This potential energy is always a negative value; energy of rotation of the bodiesabout their axes is not counted here)

• If the sum of the energies is negative, then they both trace out ellipses.• If the sum of both energies is zero, then they both trace out parabolas. As the distance between the bodies tends to

infinity, their relative speed tends to zero.• If the sum of both energies is positive, then they both trace out hyperbolas. As the distance between the bodies tends

to infinity, their relative speed tends to some positive number.

[21] For this approach see Lindsay’s Physical Mechanics, Chapter 3, "Curvilinear Motion in a Plane,” and specifically para-graph 3-9, "Planetary Motion"; and continue reading on to the Chapter’s end, pp. 83-96. Lindsay presentation goes a longway in explaining these latter comments for the fixed 2-body problem; i.e., when the Sun is assumed fixed.

[22] Note: The fact a parabolic orbit has zero energy arises from the assumption the gravitational potential energy goes to zeroas the bodies get infinitely far apart. One could assign any value to the potential energy in the state of infinite separation.That state is assumed to have zero potential energy by convention.

[23] Science Program’s The Nature of the Universe states Clarence Cleminshaw (1902-1985) served as Assistant Director ofGriffith Observatory from 1938-1958 and as Director from 1958-1969. Some publications by Cleminshaw, C. H.: CelestialSpeeds, 4 1953, equation, Kepler, orbit, comet, Saturn, Mars, velocity; Cleminshaw, C. H.: The Coming Conjunction ofJupiter and Saturn, 7 1960, Saturn, Jupiter, observe, conjunction; Cleminshaw, C. H.: The Scale of The Solar System,7 1959, Solar system, scale, Jupiter, sun, size, light.

Page 63: Computational Problems

56 CHAPTER 16. N-BODY PROBLEM

[24] Brush, Stephen G. Editor: Maxwell on Saturn’s Rings, MIT Press, 1983.

[25] See Jacob Bronowski and Bruce Mazlish's The Western Intellectual Tradition, Dorset Press, 1986, for a discussion ofthis apparent lack of understanding by Newton. Also see Truesdell’s Essays in the History of Mechanics for additionalbackground about Newton accomplishments or lack therein.

[26] As Hufbauer points out, Newton miscalculated and published unfortunately the wrong value for the Sun’s mass twice beforehe got it correct in his third attempt.

[27] See Leimanis and Minorsky’s historical comments.

[28] See Moulton’s Restricted Three-body Problem 's analytical and graphical solution.

[29] See Meirovitch’s book: Chapters 11, Problems in Celestial Mechanics; 12, Problem in Spacecraft Dynamics; and AppendixA: Dyadics.

[30] Chierchia 2010

[31] Féjoz 2004

[32] See Chierchia 2010 for animations illustrating homographic motions

[33] Celletti 2008

[34] Zhihong Xia. The Existence of Noncollision Singularities in Newtonian Systems. Annals of Mathematics. Second Series,Vol. 135, No. 3 (May, 1992), pp. 411-468

[35] Joseph L. Gerver, Noncollision Singularities: Do Four Bodies Suffice?, Exp. Math. (2003), 187-198.

[36] Saari, Donald G. (1977). “A global existence theorem for the four-body problem of Newtonian mechanics”. J. DifferentialEquations 26: 80–111. Bibcode:1977JDE....26...80S. doi:10.1016/0022-0396(77)90100-0.

[37] Alligood 1996

[38] Blanchet 2001

[39] Krumscheid 2010

[40] Board 1999

[41] Ram 2010

16.9 References

• Aarseth, Sverre J.: Gravitational N-body Simulations, Tools and Algorithms, Cambridge University Press,2003.

• Alligood, K. T., Sauer, T. D., and Yorke, J. A., Chaos: An introduction to Dynamical systems, Springer,pp. 46–48, 1996.

• Bate, Roger R.; Mueller, Donald D.; and White, Jerry: Fundamentals of Astrodynamics, Dover, 1971.

• Blanchet, Luc. On the two-body problem in general relativity, Comptes Rendus de l'Académie des Sciences-Series IV-Physics 2, no. 9 (2001): 1343-1352.

• Board, John A. Jr (1999), Humphres, Christopher W., Lambert, Christophe G., Rankin, William T., and Touk-maji, Abdulnour Y., Ewald and Multipole Methods for Periodic N-Body Problems, in the bookComputationalMolecular Dynamics: Challenges, Methods, Ideas by editors Deuflhard, Peter, Hermans, Jan, Leimkuhler,Benedict, Mark, Alan E., Reich, Sebastian, and Skeel, Robert D., Springer Berlin Heidelberg, pp. 459–471,doi:10.1007/978-3-642-58360-5_27, ISBN 978-3-540-63242-9.

• Bronowski, Jacob and Mazlish, Bruce: The Western Intellectual Tradition, from Leonardo to Hegel,Dorsey Press. 1986.

• Celletti, Alessandra (2008), Computational celestial mechanics, Scholarpedia, 3(9):4079, doi:10.4249/scholarpedia.4079

Page 64: Computational Problems

16.9. REFERENCES 57

• Chenciner, Alain (2007), Three body problem, Scholarpedia, 2(10):2111, doi:10.4249/scholarpedia.2111

• Chierchia, Luigi and Mather, John N. (2010), Kolmogorov-Arnold-Moser Theory, Scholarpedia, 5(9):2123,doi:10.4249/scholarpedia.2123

• Cohen, I. Bernard: "Newton’s Discovery of Gravity,” Scientific American, pp. 167–179, Vol. 244, No. 3,Mar. 1980.

• Cohen, I. Bernard: The Birth of a New Physics, Revised and Updated, W.W. Norton & Co., 1985.

• Diacu, F.: The solution of the n-body problem, The Mathematical Intelligencer,1996,18,p. 66–70

• Féjoz, J (2004). Dèmonstration du `théorème d'Arnol'd' sur la stabilité du système planétaire (d'après Herman),Ergodic Theory Dynam. Systems, vol 5 : 1521-1582.

• Heggie, Douglas and Hut, Piet: The Gravitational Million-Body Problem, AMultidisciplinary Approachto Star Cluster Dynamics, Cambridge University Press, 357 pages, 2003.

• Heggie, Douglas C.: "Chaos in the N-body Problem of Stellar Dynamics,” in Predictability, Stability andChaos in N-Body Dynamical Systems, Ed. by Roy A. E., Plenum Press, 1991.

• Hufbauer, Dr. Karl C. (History of Science): Exploring the Sun, Solar Science since Galileo, The JohnsHopkins University Press, 1991. This book was sponsored by the NASA History Office.

• Krumscheid, Sebastian (2010), Benchmark of fast Coulomb Solvers for open and periodic boundary conditions,Jülich Supercomputing Centre, Technical Report FZJ-JSC-IB-2010-01.

• Kurth, Rudolf, Introduction to the Mechanics of the Solar System, Pergamon Press, 1959.

• Leimanis, E., and Minorsky, N.: Dynamics and Nonlinear Mechanics, Part I: Some Recent Advances in theDynamics of Rigid Bodies and Celestial Mechanics (Leimanis), Part II: The Theory of Oscillations (Minorsky),John Wiley & Sons, Inc., 1958.

• Lindsay, Robert Bruce: Physical Mechanics, 3rd Ed., D. Van Nostrand Co., Inc., 1961.

• Meirovitch, Leonard: Methods of Analytical Dynamics, McGraw-Hill Book Co., 1970.

• Meyer, Kenneth Ray and Hall, Glen R., Introduction to Hamiltonian Dynamical Systems and the N-bodyProblem, Springer Science+Business Media, LLC, 2009, doi:10.1007/978-0-387-09724-4 2.

• Mittag-Leffler, G.: The n-body problem (Price Announcement), Acta Matematica, 1885/1886,7

• Moulton, Forest Ray: An Introduction to Celestial Mechanics, Dover, 1970.

• Newton, I.: Philosophiae Naturalis Principia Mathematica, London, 1687: also English translation of 3rd(1726) edition by I. Bernard Cohen and Anne Whitman (Berkeley, CA, 1999).

• Ram, Parikshit (2009), Dongryeol Lee, William B. March, and Alexander G. Gray. Linear-time Algorithmsfor Pairwise Statistical Problems, in NIPS, pp. 1527–1535. 2009.

• Rosenberg, Reinhardt M.: Analytical Dynamics, of Discrete Systems, Chapter 19, About Celestial Problems,paragraph 19.5, The n-body Problem, pp. 364–371, PlenumPress, 1977. Like Battin above, Rosenberg employsenergy methods too, and to the solution of the general n-body problem but doesn't actually solve anything.

• Science Program’s The Nature of the Universe, booklet, published by Nelson Doubleday, Inc., 1968.

• Sundman, K. F.: Memoire sur le probleme de trois corps, Acta Mathematica 36 (1912): 105–179.

• Tisserand, F-F.: Mecanique Celeste, tome III (Paris, 1894), ch.III, at p. 27.

• Trenti, Michele and Hut, Piet (2008), N-body simulations, Scholarpedia, 3(5):3930, doi:10.4249/scholarpedia.3930

• Truesdell, Clifford: Essays in the History of Mechanics, Springer-Verlay, 1968.

• van Winter, Clasine: The n-body problem on a Hilbert space of analytic functions, Paper 11-29, in AnalyticMethods inMathematical Physics, edited by Robert P. Gilbert and Roger G. Newton, pp. 569–578, Gordonand Breach, 1970.

Page 65: Computational Problems

58 CHAPTER 16. N-BODY PROBLEM

• Wang, Qiudong (1991). “The global solution of the n-body problem”. Celestial Mechanics and DynamicalAstronomy 50 (1): 73–88. Bibcode:1991CeMDA..50...73W. doi:10.1007/BF00048987. ISSN 0923-2958.

• Xia, Zhihong (1992). “The Existence of Noncollision Singularities in Newtonian Systems”. Annals Math. 135(3): 411–468. JSTOR 2946572.

16.10 Further reading• Brouwer, Dirk and Clemence, Gerald M.: Methods of Celestial Mechanics, Academic Press, 1961.

• Battin, Richard H.: An Introduction to The Mathematics and Methods of Astrodynamics, AIAA, 1987.He employs energy methods rather than a Newtonian approach.

• Gelman, Harry: Part I: The second orthogonality conditions in the theory of proper and improper rotations:Derivation of the conditions and of their main consequences, J. Res. NBS 72B (Math. Sci.)No. 3, 1968. PartII: The intrinsic vector; Part III: The Conjugacy Theorem,J. Res. NBS 72B (Math. Sci.) No. 2, 1969. A Noteon the time dependence of the effective axis and angle of a rotation, J. Res. NBS 72B (Math. Sci.)No. 3&4,Oct. 1971. These papers are on the Internet.

• Meriam, J. L.: Engineering Mechanics, Volume 1 Statics, Volume 2 Dynamics, John Wiley & Sons, 1978.

• Quadling, Henley: "Gravitational N-Body Simulation: 16 bit DOS version,” June 1994. nbody*.zip isavailable at the http://www.ftp.cica.indiana.edu: see external links.

• Korenev, G. V.: The Mechanics of Guided Bodies, CRC Press, 1967.

• Eisele, John A. and Mason, Robert M.: Applied Matrix and Tensor Analysis, John Wiley & Sons, 1970.

• Murray, Carl D. and Dermott, Stanley F.: Solar System Dynamics, Cambridge University Press, 606 pages,2000.

• Crandall, Richard E.: Topics in Advanced Scientific Computation, Chapter 5, "Nonlinear & Complex Sys-tems,” paragraph 5.1, "N-body problems & chaos,” pp. 215–221, Springer-Verlag, 1996.

• Crandall, Richard E.: Projects in Scientific Computation, Chapter 2, "Exploratory Computation,” Project2.4.1, "Classical Physics,” pp. 93–97, corrected 3rd printing, Springer-Verlag, 1996.

• Szebehely, Victor: Theory of Orbits, Academic Press, 1967.

• Saari, D. (1990). “A visit to the Newtonian n-body problem via Elementary Complex Variables”. AmericanMathematical Monthly 89: 105–119.

• Saari, D. G.; Hulkower, N. D. (1981). “On the Manifolds of Total Collapse Orbits and of Completely ParabolicOrbits for the n-Body Problem”. Journal ofDifferential Equations 41 (1): 27–43. Bibcode:1981JDE....41...27S.doi:10.1016/0022-0396(81)90051-6.

• Hagihara, Y: Celestial Mechanics. (Vol I and Vol II pt 1 and Vol II pt 2.) MIT Press, 1970.

• Boccaletti, D. and Pucacco, G.: Theory of Orbits (two volumes). Springer-Verlag, 1998.

• Havel, Karel. N-Body Gravitational Problem: Unrestricted Solution (ISBN 978-09689120-5-8). Brampton:Grevyt Press, 2008. http://www.grevytpress.com

16.11 External links• Three-Body Problem at Scholarpedia

• More detailed information on the three-body problem

• Regular Keplerian motions in classical many-body systems

• Applet demonstrating chaos in restricted three-body problem

Page 66: Computational Problems

16.11. EXTERNAL LINKS 59

• Applets demonstrating many different three-body motions

• On the integration of the n-body equations

• Java applet simulating Solar System

• Java applet simulating a ring of bodies orbiting a large central mass

• Java applet simulating dust in the Solar System

• Java applet simulating a stable solution to the equi-mass 3-body problem

• Java applet simulating choreographies and other interesting n-body solutions

• A java applet to simulate the 3-d movement of set of particles under gravitational interaction

• Javascript Simulation of our Solar System

• The Lagrange Points - with links to the original papers of Euler and Lagrange, and to translations, with dis-cussion

Page 67: Computational Problems

Chapter 17

Optimization problem

In mathematics and computer science, an optimization problem is the problem of finding the best solution from allfeasible solutions. Optimization problems can be divided into two categories depending on whether the variables arecontinuous or discrete. An optimization problem with discrete variables is known as a combinatorial optimizationproblem. In a combinatorial optimization problem, we are looking for an object such as an integer, permutationor graph from a finite (or possibly countable infinite) set. Problems with continuous variables include constrainedproblems and multimodal problems.

17.1 Continuous optimization problem

The standard form of a (continuous) optimization problem is[1]

minimizex

f(x)

subject to gi(x) ≤ 0, i = 1, . . . ,m

hi(x) = 0, i = 1, . . . , p

where

• f(x) : Rn → R is the objective function to be minimized over the variable x ,

• gi(x) ≤ 0 are called inequality constraints, and

• hi(x) = 0 are called equality constraints.

By convention, the standard form defines a minimization problem. A maximization problem can be treated bynegating the objective function.

17.2 Combinatorial optimization problem

Formally, a combinatorial optimization problem A is a quadruple (I, f,m, g) , where

• I is a set of instances;

• given an instance x ∈ I , f(x) is the set of feasible solutions;

• given an instance x and a feasible solution y of x , m(x, y) denotes the measure of y , which is usually a positivereal.

• g is the goal function, and is either min or max .

60

Page 68: Computational Problems

17.2. COMBINATORIAL OPTIMIZATION PROBLEM 61

The goal is then to find for some instance x an optimal solution, that is, a feasible solution y with

m(x, y) = gm(x, y′) | y′ ∈ f(x).

For each combinatorial optimization problem, there is a corresponding decision problem that asks whether there is afeasible solution for some particular measure m0 . For example, if there is a graph G which contains vertices u andv , an optimization problem might be “find a path from u to v that uses the fewest edges”. This problem might havean answer of, say, 4. A corresponding decision problem would be “is there a path from u to v that uses 10 or feweredges?" This problem can be answered with a simple 'yes’ or 'no'.In the field of approximation algorithms, algorithms are designed to find near-optimal solutions to hard problems. Theusual decision version is then an inadequate definition of the problem since it only specifies acceptable solutions. Eventhough we could introduce suitable decision problems, the problem is more naturally characterized as an optimizationproblem.[2]

17.2.1 NP optimization problem

AnNP-optimization problem (NPO) is a combinatorial optimization problem with the following additional conditions.[3]

Note that the below referred polynomials are functions of the size of the respective functions’ inputs, not the size ofsome implicit set of input instances.

• the size of every feasible solution y∈f(x) is polynomially bounded in the size of the given instance x ,

• the languages x | x∈I and (x,y) | y∈f(x) can be recognized in polynomial time, and

• m is polynomial-time computable.

This implies that the corresponding decision problem is in NP. In computer science, interesting optimization problemsusually have the above properties and are therefore NPO problems. A problem is additionally called a P-optimization(PO) problem, if there exists an algorithm which finds optimal solutions in polynomial time. Often, when dealing withthe class NPO, one is interested in optimization problems for which the decision versions are NP-complete. Notethat hardness relations are always with respect to some reduction. Due to the connection between approximationalgorithms and computational optimization problems, reductions which preserve approximation in some respect arefor this subject preferred than the usual Turing and Karp reductions. An example of such a reduction would be theL-reduction. For this reason, optimization problems with NP-complete decision versions are not necessarily calledNPO-complete.[4]

NPO is divided into the following subclasses according to their approximability:[3]

• NPO(I): Equals FPTAS. Contains the Knapsack problem.

• NPO(II): Equals PTAS. Contains the Makespan scheduling problem.

• NPO(III): :The class of NPO problems that have polynomial-time algorithms which computes solutions witha cost at most c times the optimal cost (for minimization problems) or a cost at least 1/c of the optimal cost(for maximization problems). In Hromkovič's book, excluded from this class are all NPO(II)-problems save ifP=NP. Without the exclusion, equals APX. Contains MAX-SAT and metric TSP.

• NPO(IV): :The class of NPO problems with polynomial-time algorithms approximating the optimal solution bya ratio that is polynomial in a logarithm of the size of the input. In Hromkovic’s book, all NPO(III)-problemsare excluded from this class unless P=NP. Contains the set cover problem.

• NPO(V): :The class of NPO problems with polynomial-time algorithms approximating the optimal solution bya ratio bounded by some function on n. In Hromkovic’s book, all NPO(IV)-problems are excluded from thisclass unless P=NP. Contains the TSP and Max Clique problems.

Another class of interest is NPOPB, NPO with polynomially bounded cost functions. Problems with this conditionhave many desirable properties.

Page 69: Computational Problems

62 CHAPTER 17. OPTIMIZATION PROBLEM

17.3 References[1] Boyd, Stephen P.; Vandenberghe, Lieven (2004). Convex Optimization (PDF). Cambridge University Press. p. 129. ISBN

978-0-521-83378-3.

[2] Ausiello, Giorgio et al. (2003), Complexity and Approximation (Corrected ed.), Springer, ISBN 978-3-540-65431-5

[3] Hromkovic, Juraj (2002), Algorithmics for Hard Problems, Texts in Theoretical Computer Science (2nd ed.), Springer,ISBN 978-3-540-44134-2

[4] Kann, Viggo (1992), On the Approximability of NP-complete Optimization Problems, Royal Institute of Technology, Sweden,ISBN 91-7170-082-X

17.4 See also• Mathematical optimization

• Semi-infinite programming

• Decision problem

• Search problem

• Counting problem (complexity)

• Function problem

Page 70: Computational Problems

Chapter 18

Promise problem

In computational complexity theory, a promise problem is a generalization of a decision problem where the inputis promised to belong to a subset of all possible inputs.[1] Unlike decision problems, the yes instances (the inputs forwhich an algorithm must return yes) and no instances do not exhaust the set of all inputs. Intuitively, the algorithmhas been promised that the input does indeed belong to set of yes instances or no instances. There may be inputswhich are neither yes or no. If such an input is given to an algorithm for solving a promise problem, the algorithm isallowed to output anything, and may even not halt.

18.1 Formal definition

A decision problem can be associated with a language L ⊆ 0, 1∗ , where the problem is to accept all inputs inL and reject all inputs not in L . For a promise problem, there are two languages, LYES and LNO , which must bedisjoint, which means LYES ∩ LNO = ∅ , such that all the inputs in LYES are to be accepted and all inputs in LNOare to be rejected. The set LYES ∪ LNO is called the promise. There are no requirements on the output if the inputdoes not belong to the promise. If the promise equals 0, 1∗ , then this is also a decision problem, and the promiseis said to be trivial.

18.2 Examples

Many natural problems are actually promise problems. For instance, consider the following problem: Given a directedacyclic graph, determine if the graph has a path of length 10. The yes instances are directed acyclic graphs with apath of length 10, whereas the no instances are directed acyclic graphs with no path of length 10. The promise is theset of directed acyclic graphs. In this example, the promise is easy to check. In particular, it is very easy to checkif a given graph is cyclic. However, the promised property could be difficult to evaluate. For instance, consider theproblem “Given a Hamiltonian graph, determine if the graph has a cycle of size 4.” Now the promise is NP-hard toevaluate, yet the promise problem is easy to solve since checking for cycles of size 4 can be done in polynomial time.

18.3 See also

• Computational problem

• Decision problem

• Optimization problem

• Search problem

• Counting problem (complexity)

• Function problem

63

Page 71: Computational Problems

64 CHAPTER 18. PROMISE PROBLEM

18.4 References[1] “Promise problem”. Complexity Zoo.

18.4.1 Surveys

• Goldreich, Oded (2006). OnPromise Problems (a survey). LNCS 3895. pp. 254–290. doi:10.1007/11685654_12.

• Sahai, A.; Vadhan, S.P. (1997). “A complete promise problem for statistical zero-knowledge”. FOCS 1997.pp. 448–457. doi:10.1109/SFCS.1997.646133. CiteSeerX: 10 .1 .1 .34 .6920.

• Even, Shimon; Selman, Alan L.; Yacobi, Yacov (1984). “The complexity of promise problems with applica-tions to public-key cryptography”. Information and Control 61 (2): 159–173. doi:10.1016/S0019-9958(84)80056-X.

Page 72: Computational Problems

Chapter 19

Search problem

In computational complexity theory and computability theory, a search problem is a type of computational problemrepresented by a binary relation. If R is a binary relation such that field(R) ⊆ Γ+ and T is a Turing machine, then Tcalculates R if:

• If x is such that there is some y such that R(x, y) then T accepts x with output z such that R(x, z) (there may bemultiple y, and T need only find one of them)

• If x is such that there is no y such that R(x, y) then T rejects x

Intuitively, the problem consists in finding structure “y” in object “x”. An algorithm is said to solve the problemif at least one corresponding structure exists, and then one occurrence of this structure is outputted; otherwise, thealgorithm stops with an appropriate output (“Item not found” or any message of the like).Such problems occur very frequently in graph theory, for example, where searching graphs for structures such asparticular matching, cliques, independent set, etc. are subjects of interest.Note that the graph of a partial function is a binary relation, and if T calculates a partial function then there is at mostone possible output.A relation R can be viewed as a search problem, and a Turing machine which calculates R is also said to solve it.Every search problem has a corresponding decision problem, namely

L(R) = x | ∃yR(x, y).

This definition may be generalized to n-ary relations using any suitable encoding which allows multiple strings to becompressed into one string (for instance by listing them consecutively with a delimiter).

19.1 Definition

A search problem is defined by:[1]

• A set of states

• A start state

• A goal state or goal test

a boolean function which tells us whether a given state is a goal state

• A successor function

a mapping from a state to a set of new states

65

Page 73: Computational Problems

66 CHAPTER 19. SEARCH PROBLEM

19.2 Objective

Find a solution when not given an algorithm to solve a problem, but only a specification of what a solution lookslike.[2]

19.3 Search method• Generic search algorithm: given a graph, start nodes, and goal nodes, incrementally explore paths from the

start nodes.

• Maintain a frontier of paths from the start node that have been explored.

• As search proceeds, the frontier expands into the unexplored nodes until a goal node is encountered.

• The way in which the frontier is expanded defines the search strategy.[3]

Input: a graph, a set of start nodes, Boolean procedure goal(n) that tests if n is a goal node. frontier := s : s is astart node; while frontier is not empty: select and remove path <n0, ..., nk> from frontier; if goal(nk) return <n0,..., nk>; for every neighbor n of nk add <n0, ..., nk, n> to frontier; end while

19.4 References[1] Leyton-Brown, Kevin. “Graph Search” (PDF). ubc. Retrieved 7 February 2013.

[2] Leyton-Brown, Kevin. “Graph Search” (PDF). ubc. Retrieved 7 February 2013.

[3] Leyton-Brown, Kevin. “Graph Search” (PDF). ubc. Retrieved 7 February 2013.

19.5 See also• Decision problem

• Optimization problem

• Counting problem (complexity)

• Function problem

• Search games

This article incorporates material from search problem on PlanetMath, which is licensed under the Creative CommonsAttribution/Share-Alike License.

Page 74: Computational Problems

Chapter 20

Set splitting problem

In computational complexity theory, the Set Splitting problem is the following decision problem: given a family Fof subsets of a finite set S, decide whether there exists a partition of S into two subsets S1, S2 such that all elementsof F are split by this partition, i.e., none of the elements of F is completely in S1 or S2. Set Splitting is one ofGarey&Johnson’s classical NP-complete problems.[1]

20.1 Variants

The optimization version of this problem is called Max Set Splitting and requires finding the partition which max-imizes the number of split elements of F. It is an APX-complete[2] (and hence NPO-hard) problem. When eachelement of F is restricted to be of cardinality exactly k, the decision variant is called Ek-Set Splitting and the opti-mization versionMax Ek-Set Splitting. For k ≥ 2, the former remains NP complete and the latter APX complete.[3]

The Weighted Set Splitting is a variant in which the subsets in F have weights and the objective is to maximize thetotal weight of the split subsets.

20.2 Connection to Other Problems

Set Splitting is special case of the Not-All-Equal Satisfiability problem without negated variables. Additionally, Ek-Set Splitting equals non-monochromatic graph coloring of k-uniform hypergraphs. For k=2, the optimization variantreduces to the well-known Maximum cut.[4]

20.3 Approximability

For k ≥ 4, Ek-Set Splitting is approximation resistant. That is, unless P=NP, there is no polynomial-time (factor)approximation algorithm which does essentially better than a random partition.[5][4]

20.4 Fixed-Parameter Tractability

An alternative formulation of the decision variant is the following: given an integer k, does there exist a partition ofS which splits at least k subsets of F? This formulation is fixed-parameter tractable - for every fixed k, there exists apolynomial-time algorithm for solving the problem.[6]

20.5 References[1] Garey, Michael R.; Johnson, David S. (1979). Computers and Intractability: A Guide to the Theory of NP-Completeness.

New York: W.H. Freeman. ISBN 0-7167-1045-5.

67

Page 75: Computational Problems

68 CHAPTER 20. SET SPLITTING PROBLEM

[2] Petrank, Erez (1994). “The Hardness of Approximation: Gap Location”. Computational Complexity (Springer).

[3] Lovász, László (1973). Coverings and Colorings of Hypergraphs. Symposium on Theory of Computing. Association forComputing Machinery.

[4] Guruswami, Venkatesan (2003). “Inapproximability Results for Set Splitting and Satisfiability Problems with no MixedClauses”. Algorithmica (Springer) 38: 451–469. doi:10.1007/s00453-003-1072-z.

[5] Håstad, Johan (2001). “Some Optimal Inapproximability Results”. Journal of the ACM (Association for Computing Ma-chinery) 48: 798–859. doi:10.1145/502090.502098.

[6] Dehne, Frank; Fellows, Michael; Rosamond, Frances (2003). AnFPTAlgorithm for Set Splitting. Graph Theoretic Conceptsin Computer Science. Springer.

Page 76: Computational Problems

Chapter 21

Sharp-P-completeness of 01-permanent

The correct title of this article is #P-completeness of 01-permanent. The substitution or omission of the # is be-cause of technical restrictions.

The #P-completeness of 01-permanent, sometimes known as Valiant’s theorem,[1] is a mathematical proof aboutthe permanent of matrices, considered a seminal result in computational complexity theory.[2][3] In a 1979 scholarlypaper, Leslie Valiant proved[4] that the computational problem of computing the permanent of a matrix is #P-hard,even if the matrix is restricted to have entries that are all 0 or 1. In this restricted case, computing the permanent iseven #P-complete, because it corresponds to the #P problem of counting the number of permutation matrices onecan get by changing ones into zeroes.Valiant’s 1979 paper also introduced #P as a complexity class.[5]

21.1 Significance

One reason for interest in the computational complexity of the permanent is that it provides an example of a problemwhere constructing a single solution can be done efficiently but where counting all solutions is hard.[6] As Papadim-itriou writes in his book Computational Complexity:Specifically, computing the permanent (shown to be difficult by Valiant’s results) is closely connected with finding aperfect matching in a bipartite graph, which is solvable in polynomial time by the Hopcroft–Karp algorithm.[7][8] For abipartite graph with 2n vertices partitioned into two parts with n vertices each, the number of perfect matchings equalsthe permanent of its biadjacency matrix and the square of the number of perfect matchings is equal to the permanentof its adjacency matrix.[9] Since any 0–1 matrix is the biadjacency matrix of some bipartite graph, Valiant’s theoremimplies[9] that the problem of counting the number of perfect matchings in a bipartite graph is #P-complete, and inconjunction with Toda’s theorem this implies that it is hard for the entire polynomial hierarchy.[10][11]

The computational complexity of the permanent also has some significance in other aspects of complexity theory:it is not known whether NC equals P (informally, whether every polynomially-solvable problem can be solved by apolylogarithmic-time parallel algorithm) and Ketan Mulmuley has suggested an approach to resolving this questionthat relies on writing the permanent as the determinant of a matrix.[12]

Hartmann [13] proved a generalization of Valiant’s theorem concerning the complexity of computing immanants ofmatrices that generalize both the determinant and the permanent.

21.2 Ben-Dor and Halevi’s proof

Below, the proof that computing the permanent of a 01-matrix is #P-complete is described. It mainly follows theproof by Ben-Dor & Halevi (1993).[14]

69

Page 77: Computational Problems

70 CHAPTER 21. SHARP-P-COMPLETENESS OF 01-PERMANENT

21.2.1 Overview

Any square matrix A = (aij) can be viewed as the adjacency matrix of a directed graph, with aij representing theweight of the edge from vertex i to vertex j. Then, the permanent of A is equal to the sum of the weights of allcycle-covers of the graph; this is a graph-theoretic interpretation of the permanent.#SAT, a function problem related to the Boolean satisfiability problem, is the problem of counting the number ofsatisfying assignments of a given Boolean formula. It is a #P-complete problem (by definition), as any NP machinecan be encoded into a Boolean formula by a process similar to that in Cook’s theorem, such that the number ofsatisfying assignments of the Boolean formula is equal to the number of accepting paths of the NP machine. Anyformula in SAT can be rewritten as a formula in 3-CNF form preserving the number of satisfying assignments, andso #SAT and #3SAT are equivalent and #3SAT is #P-complete as well.In order to prove that 01-Permanent is #P-hard, it is therefore sufficient to show that the number of satisfying assign-ments for a 3-CNF formula can be expressed succinctly as a function of the permanent of a matrix that contains onlythe values 0 and 1. This is usually accomplished in two steps:

1. Given a 3-CNF formula φ, construct a directed integer-weighted graph Gϕ , such that the sum of the weights ofcycle covers of Gϕ (or equivalently, the permanent of its adjacency matrix) is equal to the number of satisfyingassignments of φ. This establishes that Permanent is #P-hard.

2. Through a series of reductions, reduce Permanent to 01-Permanent, the problem of computing the permanentof a matrix all entries 0 or 1. This establishes that 01-permanent is #P-hard as well.

21.2.2 Constructing the integer graph

Given a 3CNF-formula ϕ with m clauses and n variables, one can construct a weighted, directed graph Gϕ such that

1. each satisfying assignment for ϕ will have a corresponding set of cycle covers in Gϕ where the sum of theweights of cycle covers in this set will be 12m ; and

2. all other cycle covers in Gϕ will have weights summing to 0.

Thus if (#ϕ) is the number of satisfying assignments for ϕ , the permanent of this graph will be 12m ·(#ϕ) . (Valiant’soriginal proof constructs a graph with entries in −1, 0, 1, 2, 3 whose permanent is 4t(ϕ) · (#ϕ) where t(ϕ) is “twicethe number of occurrences of literals in ϕ " – m .)The graph construction makes use of a component that is treated as a “black box.” To keep the explanation simple,the properties of this component are given without actually defining the structure of the component.To specify Gφ, one first constructs a variable node in Gφ for each of the n variables in φ. Additionally, for each of them clauses in φ, one constructs a clause component Cj in Gφ that functions as a sort of “black box.” All that needs tobe noted about Cj is that it has three input edges and three output edges. The input edges come either from variablenodes or from previous clause components (e.g., Co for some o < j) and the output edges go either to variable nodesor to later clause components (e.g., Co for some o > j ). The first input and output edges correspond with the firstvariable of the clause j, and so on. Thus far, all of the nodes that will appear in the graph Gφ have been specified.Next, one would consider the edges. For each variable xi of ϕ , one makes a true cycle (T-cycle) and a false cycle (F-cycle) in Gϕ . To create the T-cycle, one starts at the variable node for xi and draw an edge to the clause componentCj that corresponds to the first clause in which xi appears. If xi is the first variable in the clause of ϕ correspondingto Cj , this edge will be the first input edge of Cj , and so on. Thence, draw an edge to the next clause componentcorresponding to the next clause of ϕ in which xi appears, connecting it from the appropriate output edge of Cj tothe appropriate input edge of the next clause component, and so on. After the last clause in which xi appears, weconnect the appropriate output edge of the corresponding clause component back to xi 's variable node. Of course,this completes the cycle. To create the F-cycle, one would follow the same procedure, but connect xi 's variable nodeto those clause components in which ~ xi appears, and finally back to xi 's variable node. All of these edges outsidethe clause components are termed external edges, all of which have weight 1. Inside the clause components, the edgesare termed internal edges. Every external edge is part of a T-cycle or an F-cycle (but not both—that would forceinconsistency).Note that the graph Gϕ is of size linear in |ϕ| , so the construction can be done in polytime (assuming that the clausecomponents do not cause trouble).

Page 78: Computational Problems

21.2. BEN-DOR AND HALEVI’S PROOF 71

Notable properties of the graph

A useful property of Gϕ is that its cycle covers correspond to variable assignments for ϕ . For a cycle cover Z of Gϕ

, one can say that Z induces an assignment of values for the variables in ϕ just in case Z contains all of the externaledges in xi 's T-cycle and none of the external edges in xi 's F-cycle for all variables xi that the assignment makestrue, and vice versa for all variables xi that the assignment makes false. Although any given cycle cover Z need notinduce an assignment for ϕ , any one that does induces exactly one assignment, and the same assignment induceddepends only on the external edges of Z. The term Z is considered an incomplete cycle cover at this stage, becauseone talks only about its external edges, M. In the section below, one considers M-completions to show that one has aset of cycle covers corresponding to each M that have the necessary properties.The sort of Z's that don't induce assignments are the ones with cycles that “jump” inside the clause components. Thatis, if for every Cj , at least one of Cj 's input edges is in Z, and every output edge of the clause components is inZ when the corresponding input edge is in Z, then Z is proper with respect to each clause component, and Z willproduce a satisfying assignment for ϕ . This is because proper Z's contain either the complete T-cycle or the completeF-cycle of every variable xi in ϕ as well as each including edges going into and coming out of each clause component.Thus, these Z's assign either true or false (but never both) to each xi and ensure that each clause is satisfied. Further,the sets of cycle covers corresponding to all such Z's have weight 12m , and any other Z's have weight 0 . The reasonsfor this depend on the construction of the clause components, and are outlined below.

The clause component

To understand the relevant properties of the clause components Cj , one needs the notion of an M-completion. Acycle cover Z induces a satisfying assignment just in case its external edges satisfy certain properties. For any cyclecover of Gϕ , consider only its external edges, the subset M. Let M be a set of external edges. A set of internal edgesL is an M-completion just in case M ∪ L is a cycle cover of Gϕ . Further, denote the set of all M-completions byLM and the set of all resulting cycle covers of Gϕ by ZM .Recall that construction of Gϕ was such that each external edge had weight 1, so the weight of ZM , the cycle coversresulting from any M, depends only on the internal edges involved. We add here the premise that the construction ofthe clause components is such that the sum over possible M-completions of the weight of the internal edges in eachclause component, where M is proper relative to the clause component, is 12. Otherwise the weight of the internaledges is 0. Since there are m clause components, and the selection of sets of internal edges, L, within each clausecomponent is independent of the selection of sets of internal edges in other clause components, so one can multiplyeverything to get the weight of ZM . So, the weight of each ZM , where M induces a satisfying assignment, is 12m .Further, where M does not induce a satisfying assignment, M is not proper with respect to some Cj , so the productof the weights of internal edges in ZM will be 0 .The clause component is a weighted, directed graph with 7 nodes with edges weighted and nodes arranged to yieldthe properties specified above, and is given in Appendix A of Ben-Dor and Halevi (1993). Note that the internaledges here have weights drawn from the set −1, 0, 1, 2, 3 ; not all edges have 0–1 weights.Finally, since the sum of weights of all the sets of cycle covers inducing any particular satisfying assignment is 12m,and the sum of weights of all other sets of cycle covers is 0, one has Perm(Gφ) = 12m·(#φ). The following sectionreduces computing Perm( Gϕ ) to the permanent of a 01 matrix.

21.2.3 01-Matrix

The above section has shown that Permanent is #P-hard. Through a series of reductions, any permanent can bereduced to the permanent of a matrix with entries only 0 or 1. This will prove that 01-Permanent is #P-hard as well.

Reduction to a non-negative matrix

Using modular arithmetic, convert an integer matrixA into an equivalent non-negative matrixA′ so that the permanentof A can be computed easily from the permanent of A′ , as follows:Let A be an n× n integer matrix where no entry has a magnitude larger than µ .

• Compute Q = 2n! · µn + 1 . The choice of Q is due to the fact that |Perm(A)| ≤ n! · µn

Page 79: Computational Problems

72 CHAPTER 21. SHARP-P-COMPLETENESS OF 01-PERMANENT

• Compute A′ = A mod Q

• Compute P = Perm(A′) mod Q

• If P < Q/2 then Perm(A) = P. Otherwise Perm(A) = P −Q

The transformation of A into A′ is polynomial in n and log(µ) , since the number of bits required to represent Q ispolynomial in n and log(µ)An example of the transformation and why it works is given below.

A =

[2 −2−2 1

]Perm(A) = 2 · 1 + (−2) · (−2) = 6

Here, n = 2 , µ = 2 , and µn = 4 , so Q = 17 . Thus

A′ = A mod 17 =

[2 1515 1

].

Note how the elements are non-negative because of the modular arithmetic. It is simple to compute the permanent

Perm(A′) = 2 · 1 + 15 · 15 = 227

so P = 227 mod 17 = 6 . Then P < Q/2 , so Perm(A) = P = 6.

Reduction to powers of 2

Note that any number can be decomposed into a sum of powers of 2. For example,

13 = 23 + 22 + 20

This fact is used to convert a non-negative matrix into an equivalent matrix whose entries are all powers of 2. Thereduction can be expressed in terms of graphs equivalent to the matrices.Let G be a n -node weighted directed graph with non-negative weights, where largest weight is W . Every edge ewith weight w is converted into an equivalent edge with weights in powers of 2 as follows:

w = 2x1 + 2x2 + · · ·+ 2xr , 0 ≤ x1 ≤ x2 ≤ · · · ≤ xr ≤ log(w)

This can be seen graphically in the Figure 1. The subgraph that replaces the existing edge contains r nodes and 3redges.To prove that this produces an equivalent graph G′ that has the same permanent as the original, one must show thecorrespondence between the cycle covers of G and G′ .Consider some cycle-cover R in G .

• If an edge e is not in R , then to cover all the nodes in the new sub graph, one must use the self-loops. Sinceall self-loops have a weight of 1, the weight of cycle-covers in R and R′ match.

• If e is in R , then in all the corresponding cycle-covers in G′ , there must be a path from u to v , where u and vare the nodes of edge e. From the construction, one can see that there are r different paths and sum of all thesepaths equal to the weight of the edge in the original graph G . So the weight of corresponding cycle-covers inG and G′ match.

Note that the size of G′ is polynomial in n and logW .

Page 80: Computational Problems

21.2. BEN-DOR AND HALEVI’S PROOF 73

Figure 1: Construction of 2Power from NonNeg

Reduction to 0–1

The objective here is to reduce a matrix whose entries are powers of 2 into an equivalent matrix containing only zerosand ones (i.e. a directed graph where each edge has a weight of 1).Let G be a n -node directed graph where all the weights on edges are powers of two. Construct a graph, G′ , wherethe weight of each edge is 1 and Perm(G) = Perm(G'). The size of this new graph, G', is polynomial in n and p wherethe maximal weight of any edge in graph G is 2p .This reduction is done locally at each edge in G that has a weight larger than 1. Let e = (u, v) be an edge in G witha weight w = 2r > 1 . It is replaced by a subgraph Je that is made up of 2r nodes and 6r edges as seen in Figure 2.Each edge in Je has a weight of 1. Thus, the resulting graph G' contains only edges with a weight of 1.Consider some cycle-cover R in G .

• If an original edge e from graph G is not in R , one cannot create a path through the new subgraph Je . Theonly way to form a cycle cover over Je in such a case is for each node in the subgraph to take its self-loop. Aseach edge has a weight of one, the weight of the resulting cycle cover is equal to that of the original cycle cover.

• However, if the edge in G is a part of the cycle cover then in any cycle cover of G′ there must be a path from uto v in the subgraph. At each step down the subgraph there are two choices one can make to form such a path.One must make this choice r times, resulting in 2r possible paths from u to v . Thus, there are 2r possiblecycle covers and since each path has a weight of 1, the sum of the weights of all these cycle covers equals theweight of the original cycle cover.

Page 81: Computational Problems

74 CHAPTER 21. SHARP-P-COMPLETENESS OF 01-PERMANENT

Figure 2: Construction of a 01-matrix from 2Power

21.3 Aaronson’s proof

Quantum computer scientist Scott Aaronson[15] has proved #P-hardness of permanent using quantum methods.

21.4 References[1] Christos H. Papadimitriou. Computational Complexity. Addison-Wesley, 1994. ISBN 0-201-53082-1. Page 443

[2] Allen Kent, James G. Williams, Rosalind Kent and Carolyn M. Hall (editors). Encyclopedia of microcomputers.MarcelDekker, 1999. ISBN 978-0-8247-2722-2; p. 34

[3] Jin-Yi Cai, A. Pavan and D. Sivakumar, On the Hardness of Permanent. In: STACS, '99: 16th Annual Symposium onTheoretical Aspects of Computer Science, Trier, Germany, March 4–6, 1999 Proceedings. pp. 90–99. Springer-Verlag,New York, LLC Pub. Date: October 2007. ISBN 978-3-540-65691-3; p. 90.

[4] Leslie G. Valiant (1979). “The Complexity of Computing the Permanent”. Theoretical Computer Science (Elsevier) 8 (2):189–201. doi:10.1016/0304-3975(79)90044-6.

[5] Lance Fortnow. My Favorite Ten Complexity Theorems of the Past Decade. Foundations of Software Technology and Theo-retical Computer Science: Proceedings of the 14th Conference, Madras, India, December 15–17, 1994. P. S. Thiagarajan(editor), pp. 256–275, Springer-Verlag, New York, 2007. ISBN 978-3-540-58715-6; p. 265

[6] Bürgisser, Peter (2000). Completeness and reduction in algebraic complexity theory. Algorithms and Computation in Math-ematics 7. Berlin: Springer-Verlag. p. 2. ISBN 3-540-66752-0. Zbl 0948.68082.

[7] John E. Hopcroft, Richard M. Karp: An n5/2 Algorithm for Maximum Matchings in Bipartite Graphs. SIAM J. Comput.2(4), 225–231 (1973)

Page 82: Computational Problems

21.4. REFERENCES 75

[8] Cormen, Thomas H.; Leiserson, Charles E., Rivest, Ronald L., Stein, Clifford (2001) [1990]. “26.5: The relabel-to-frontalgorithm”. Introduction to Algorithms (2nd ed.). MIT Press and McGraw-Hill. pp. pp. 696–697. ISBN 0-262-03293-7.

[9] Dexter Kozen. The Design and Analysis of Algorithms. Springer-Verlag, New York, 1991. ISBN 978-0-387-97687-7; pp.141–142

[10] Seinosuke Toda. PP is as Hard as the Polynomial-Time Hierarchy. SIAM Journal on Computing, Volume 20 (1991), Issue5, pp. 865–877.

[11] 1998 Gödel Prize. Seinosuke Toda

[12] Ketan Mulmuley. Lower Bounds in a Parallel Model without Bit Operations. SIAM Journal on Computing, Volume 28(1999), Issue 4, pp. 1460–1509.

[13] W. Hartmann. On the complexity of immanants. Linear and Multilinear Algebra 18 (1985), no. 2, pp. 127–140.

[14] Ben-Dor, Amir; Halevi, Shai (1993). “Proceedings of the 2nd Israel Symposium on the Theory and Computing Systems”.pp. 108–117. |chapter= ignored (help).

[15] S. Aaronson, A Linear-Optical Proof that the Permanent is #P-Hard

Page 83: Computational Problems

Chapter 22

Sharp-SAT

The correct title of this article is #SAT. The substitution or omission of the # is because of technical restrictions.

In computational complexity theory, #SAT, or Sharp-SAT, a function problem related to the Boolean satisfiabilityproblem, is the problem of counting the number of satisfying assignments of a given Boolean formula. It is well-known example for the class of counting problems, which are of special interest in computational complexity theory.It is a #P-complete problem, as any NP machine can be encoded into a Boolean formula by a process similar to thatin Cook’s theorem, such that the number of satisfying assignments of the Boolean formula is equal to the number ofaccepting paths of the NP machine. Any formula in SAT can be rewritten as a formula in 3-CNF form preservingthe number of satisfying assignments, and so #SAT and #3SAT are equivalent and #3SAT is #P-complete as well.

22.1 Intractable special cases

Model-counting is intractable in many special cases for which satisfiability is tractable. This includes the following.

• sets of Horn clauses

• sets of 2-literal clauses

22.2 Tractable special cases

Model-counting is tractable (solvable in polynomial time) for (ordered) BDDs and for d-DNNFs.

76

Page 84: Computational Problems

Chapter 23

Sum of radicals

In computational complexity theory there is an open problem whether some information about the sum of radicalsmay be computed in polynomial time depending on the input size, i.e., in the number of bits necessary to representthis sum. It is of importance for many problems in computational geometry, since the computation of the Euclideandistance between two points in general case involves the computation of a square root, and therefore the perimeterof a polygon or the length of a polygonal chain takes the form of a sum of radicals.[1]

The sum of radicals is defined as a finite linear combination of radicals:

Σni=1ki

ri√xi,

where n, ri are natural numbers and ki, xi are real numbers.Most theoretical research in computational geometry of combinatorial character assumes the computational model ofinfinite precision real RAM, i.e., an abstract computer in which real numbers and operations with them are performedwith infinite precision and the input size of a real number and the cost of an elementary operation are constants.[2]

However there is research in computational complexity, especially in computer algebra, where the input size of anumber is the number of bits necessary for its representation.[3]

In particular, of interest in computational geometry is the problem of determining the sign of the sum of radicals.For instance, the length of a polygonal path in which all vertices have integer coordinates may be expressed using thePythagorean theorem as a sum of integer square roots, so in order to determine whether one path is longer or shorterthan another in a Euclidean shortest path problem, it is necessary to determine the sign of an expression in which thefirst path’s length is subtracted from the second; this expression is a sum of radicals.In a similar way, the sum of radicals problem is inherent in the problem of minimum-weight triangulation in theEuclidean metric.In 1991, Blömer proposed a polynomial time Monte Carlo algorithm for determining whether a sum of radicalsis zero, or more generally whether it represents a rational number.[4] While Blömer’s result does not resolve thecomputational complexity of finding the sign of the sum of radicals, it does imply that if the latter problem is in classNP, then it is also in co-NP.[4]

23.1 See also• Nested radicals

• Abel–Ruffini theorem

23.2 References[1] Wolfgang Mulzer, Günter Rote, “Minimum-Weight Triangulation Is NP-Hard”, In: Proceedings of the 22nd Annual Sym-

posium on Computational Geometry, Sedona, June 5–7, 2006, Journal of the ACM, Vol. 55, No. 2, 2008.

77

Page 85: Computational Problems

78 CHAPTER 23. SUM OF RADICALS

[2] Franco P. Preparata and Michael Ian Shamos (1985). Computational Geometry - An Introduction. Springer-Verlag. ISBN0-387-96131-3. 1st edition: 2nd printing, corrected and expanded, 1988: ISBN 3-540-96131-3; Russian translation, 1989:ISBN 5-03-001041-6.

[3] Computer Algebra Handbook, 2003, ISBN 3-540-65466-6

[4] Blömer, Johannes (1991). “Computing sums of radicals in polynomial time”. p. 670. doi:10.1109/SFCS.1991.185434..

Page 86: Computational Problems

Chapter 24

Tutte polynomial

This article is about the Tutte polynomial of a graph. For the Tutte polynomial of a matroid, see Matroid.The Tutte polynomial, also called the dichromate or the Tutte–Whitney polynomial, is a polynomial in two vari-

The polynomial x4 + x3 + x2y is the Tutte polynomial of the bull graph. The red line shows the intersection with the plane y = 0, equivalent to the chromatic polynomial.

ables which plays an important role in graph theory. It is defined for every undirected graph and contains informationabout how the graph is connected.The importance of the Tutte polynomial TG comes from the information it contains about G. Though originallystudied in algebraic graph theory as a generalisation of counting problems related to graph coloring and nowhere-zero flow, it contains several famous other specialisations from other sciences such as the Jones polynomial from knottheory and the partition functions of the Potts model from statistical physics. It is also the source of several centralcomputational problems in theoretical computer science.The Tutte polynomial has several equivalent definitions. It is equivalent to Whitney’s rank polynomial, Tutte’sown dichromatic polynomial and Fortuin–Kasteleyn’s random cluster model under simple transformations. Itis essentially a generating function for the number of edge sets of a given size and connected components, withimmediate generalisations to matroids. It is also the most general graph invariant that can be defined by a deletion–

79

Page 87: Computational Problems

80 CHAPTER 24. TUTTE POLYNOMIAL

contraction recurrence. Several textbooks about graph theory and matroid theory devote entire chapters to it.[1]

24.1 DefinitionsDefinition. For an undirected graph G = (V,E) one may define the Tutte polynomial as

TG(x, y) =∑

A⊆E(x− 1)k(A)−k(E)(y − 1)k(A)+|A|−|V |,

where k(A) denotes the number of connected components of the graph (V,A) . In this definition it isclear that TG is well-defined and a polynomial in x and y.

The same definition can be given using slightly different notation by letting r(A) = |V | − k(A) denote the rank ofthe graph (V,A) . Then the Whitney rank generating function is defined as

RG(u, v) =∑

A⊆Eur(E)−r(A)v|A|−r(A).

The two functions are equivalent under a simple change of variables:

TG(x, y) = RG(x− 1, y − 1).

Tutte’s dichromatic polynomial QG is the result of another simple transformation:

TG(x, y) = (x− 1)−k(G)QG(x− 1, y − 1).

Tutte’s original definition of TG is equivalent but less easily stated. For connected G we set

TG(x, y) =∑

i,jtijx

iyj ,

where tij denotes the number of spanning trees of “internal activity i and external activity j.”A third definition uses a deletion–contraction recurrence. The edge contraction G/uv of graph G is the graphobtained by merging the vertices u and v and removing the edge uv. We write G − uv for the graph where the edgeuv is merely removed. Then the Tutte polynomial is defined by the recurrence relation

TG = TG−e + TG/e,

if e is neither a loop nor a bridge, with base case

TG(x, y) = xiyj ,

if G contains i bridges and j loops and no other edges. Especially, TG = 1 if G contains no edges.The random cluster model from statistical mechanics due to Fortuin & Kasteleyn (1972) provides yet anotherequivalent definition.[2] The polynomial

ZG(q, w) =∑

F⊆Eqk(F )w|F |

is equivalent to TG under the transformation[3]

TG(x, y) = (x− 1)−k(E)(y − 1)−|V | · ZG

((x− 1)(y − 1), y − 1

).

Page 88: Computational Problems

24.2. HISTORY 81

24.1.1 Properties

The Tutte polynomial factors into connected components: If G is the union of disjoint graphs H and H ′ then

TG = TH · TH′

If G is planar and G∗ denotes its dual graph then

TG(x, y) = TG∗(y, x)

Especially, the chromatic polynomial of a planar graph is the flow polynomial of its dual.

24.1.2 Examples

Isomorphic graphs have the same Tutte polynomial, but the opposite is not true. For example, the Tutte polynomialof every tree on m edges is xm .Tutte polynomials are often given in tabular form by listing the coefficients tij of xiyj in row i and column j. Forexample, the Tutte polynomial of the Petersen graph,

36x+ 120x2 + 180x3 + 170x4 + 114x5 + 56x6 + 21x7 + 6x8 + x9

+ 36y + 84y2 + 75y3 + 35y4 + 9y5 + y6

+ 168xy + 240x2y + 170x3y + 70x4y + 12x5y

+ 171xy2 + 105x2y2 + 30x3y2

+ 65xy3 + 15x2y3

+ 10xy4,

is given by the following table.Other example, the Tutte polynomial of the octahedron graph is given by

12 y2x2 + 11x+ 11 y + 40 y3 + 32 y2 + 46 yx+ 24xy3 + 52xy2

+ 25x2 + 29 y4 + 15 y5 + 5 y6 + 6 y4x

+ 39 yx2 + 20x3 + y7 + 8 yx3 + 7x4 + x5

24.2 History

W. T. Tutte’s interest in the deletion–contraction formula started in his undergraduate days at Trinity College, Cam-bridge, originally motivated by perfect rectangles and spanning trees. He often applied the formula in his researchand “wondered if there were other interesting functions of graphs, invariant under isomorphism, with similar recur-sion formulae.”[4] R. M. Foster had already observed that the chromatic polynomial is one such function, and Tuttebegan to discover more. His original terminology for graph invariants that satisfy the delection–contraction recursionwas W-function, and V-function if multiplicative over components. Tutte writes, “Playing with my W-functions Iobtained a two-variable polynomial from which either the chromatic polynomial or the flow-polynomial could be ob-tained by setting one of the variables equal to zero, and adjusting signs.”[4] Tutte called this function the dichromate,as he saw it as a generalization of the chromatic polynomial to two variables, but it is usually referred to as the Tuttepolynomial. In Tutte’s words, “This may be unfair to Hassler Whitney who knew and used analogous coefficientswithout bothering to affix them to two variables.” (There is “notable confusion”[5] about the terms dichromate anddichromatic polynomial, introduced by Tutte in different paper, and which differ only slightly.) The generalisationof the Tutte polynomial to matroids was first published by Crapo, though it appears already in Tutte’s thesis.[6]

Independently of the work in algebraic graph theory, Potts began studying the partition function of certain models instatistical mechanics in 1952. The work of Fortuin & Kasteleyn (1972) on the random cluster model, a generalisationof the Potts model, provided a unifying expression that showed the relation to the Tutte polynomial.[7]

Page 89: Computational Problems

82 CHAPTER 24. TUTTE POLYNOMIAL

24.3 Specialisations

At various points and lines of the (x, y) -plane, the Tutte polynomial evaluates to quantities that have been studied intheir own right in diverse fields of mathematics and physics. Part of the appeal of the Tutte polynomial comes fromthe unifying framework it provides for analysing these quantities.

24.3.1 Chromatic polynomial

Main article: Chromatic polynomialAt y = 0 , the Tutte polynomial specialises to the chromatic polynomial,

The chromatic polynomial drawn in the Tutte plane

χG(λ) = (−1)|V |−k(G)λk(G)TG(1− λ, 0),

where k(G) denotes the number of connected components of G.For integer λ the value of chromatic polynomial χG(λ) equals the number of vertex colourings of G using a set of λcolours. It is clear that χG(λ) does not depend on the set of colours. What is less clear is that it is the evaluation at λof a polynomial with integer coefficients. To see this, we observe:

1. If G has n vertices and no edges, then χG(λ) = λn .

2. If G contains a loop (a single edge connecting a vertex to itself), then χG(λ) = 0 .

3. If e is an edge which is not a loop, then

Page 90: Computational Problems

24.3. SPECIALISATIONS 83

χG(λ) = χG\e(λ)− χG/e(λ).

The three conditions above enable us to calculate χG(λ) , by applying a sequence of edge deletions and contractions;but they give no guarantee that a different sequence of deletions and contractions will lead to the same value. Theguarantee comes from the fact that χG(λ) counts something, independently of the recurrence. In particular,

TG(2, 0) = (−1)|V |χG(−1)

gives the number of acyclic orientations.

24.3.2 Jones polynomial

Main article: Jones polynomialAlong the hyperbola xy = 1 , the Tutte polynomial of a planar graph specialises to the Jones polynomial of an

The Jones polynomial drawn in the Tutte plane

associated alternating knot.

24.3.3 Individual points

(2,1)

TG(2, 1) counts the number of forests, i.e., the number of acyclic edge subsets.

Page 91: Computational Problems

84 CHAPTER 24. TUTTE POLYNOMIAL

(1,1)

TG(1, 1) counts the number of spanning forests (edge subsets without cycles and the same number of connectedcomponents as G). If the graph is connected, T_G(1,1) counts the number of spanning trees.

(1,2)

TG(1, 2) counts the number of spanning subgraphs (edge subsets with the same number of connected components asG).

(2,0)

TG(2, 0) counts the number of acyclic orientations of G.[8]

(0,2)

TG(0, 2) counts the number of strongly connected orientations of G.[9]

(0,−2)

If G is a 4-regular graph, then

(−1)|V |+k(G)TG(0,−2)

counts the number of Eulerian orientations of G. Here k(G) is the number of connected components of G.[8]

(3,3)

If G is the m × n grid graph, then 2TG(3, 3) counts the number of ways to tile a rectangle of width 4m and height 4nwith T-tetrominoes.[10]

If G is a planar graph, then 2TG(3, 3) equals the sum over weighted Eulerian orientations in a medial graph of G,where the weight of an orientation is 2 to the number of saddle vertices of the orientation (that is, the number ofvertices with incident edges cyclicly ordered “in, out, in out”).[11]

24.3.4 Potts and Ising models

Main articles: Ising model and Potts modelDefine the hyperbola in the xy−plane:

H2 : (x− 1)(y − 1) = 2,

the Tutte polynomial specialises to the partition function, Z(·), of the Ising model studied in statistical physics.Specifically, along the hyperbola H2 the two are related by the equation:[12]

Z(G) = 2(e−α

)|E|−r(E)(4 sinhα)r(E)

TG

(cothα, e2α

).

In particular,

(cothα− 1)(e2α − 1

)= 2

Page 92: Computational Problems

24.3. SPECIALISATIONS 85

The partition functions for the Ising model and the 3- and 4-state Potts models drawn in the Tutte plane.

for all complex α.More generally, if for any positive integer q, we define the hyperbola:

Hq : (x− 1)(y − 1) = q,

then the Tutte polynomial specialises to the partition function of the q-state Potts model. Various physical quantitiesanalysed in the framework of the Potts model translate to specific parts of the Hq .

24.3.5 Flow polynomial

Main article: Nowhere-zero flowAt x = 0 , the Tutte polynomial specialises to the flow polynomial studied in combinatorics. For a connected and

undirected graph G and integer k, a nowhere-zero k-flow is an assignment of “flow” values 1, 2, . . . , k − 1 to theedges of an arbitrary orientation of G such that the total flow entering and leaving each vertex is congruent modulok. The flow polynomial CG(k) denotes the number of nowhere-zero k-flows. This value is intimately connected withthe chromatic polynomial, in fact, if G is a planar graph, the chromatic polynomial of G is equivalent to the flowpolynomial of its dual graph G∗ in the sense that

Theorem (Tutte).

CG(k) = k−1χG∗(k).

The connection to the Tutte polynomial is given by:

Page 93: Computational Problems

86 CHAPTER 24. TUTTE POLYNOMIAL

The flow polynomial drawn in the Tutte plane

CG(k) = (−1)|E|+|V |+k(G)TG(0, 1− k).

24.3.6 Reliability polynomial

Main article: Connectivity (graph theory)At x = 1 , the Tutte polynomial specialises to the all-terminal reliability polynomial studied in network theory. Fora connected graph G remove every edge with probability p; this models a network subject to random edge failures.Then the reliability polynomial is a function RG(p) , a polynomial in p, that gives the probability that every pair ofvertices in G remains connected after the edges fail. The connection to the Tutte polynomial is given by

RG(p) = (1− p)|V |−k(G)p|E|−|V |+k(G)TG

(1, 1

p

).

24.3.7 Dichromatic polynomial

Tutte also defined a closer 2-variable generalization of the chromatic polynomial, the dichromatic polynomial of agraph. This is

QG(u, v) =∑

A⊆Euk(A)v|A|−|V |+k(A),

Page 94: Computational Problems

24.4. RELATED POLYNOMIALS 87

The reliability polynomial drawn in the Tutte plane

where k(A) is the number of connected components of the spanning subgraph (V,A). This is related to the corank-nullity polynomial by

QG(u, v) = uk(G) RG(u, v).

The dichromatic polynomial does not generalize to matroids because k(A) is not a matroid property: different graphswith the same matroid can have different numbers of connected components.

24.4 Related polynomials

24.4.1 Martin polynomial

Main article: Martin polynomial

The Martin polynomial mG(x) of an oriented 4-regular graph G was defined by Pierre Martin in his 1977 thesis.[14]

In this work, Martin showed that if G is a plane graph and Gm is its directed medial graph, then

TG(x, x) = mGm(x).

Page 95: Computational Problems

88 CHAPTER 24. TUTTE POLYNOMIAL

24.5 Algorithms

24.5.1 Deletion–contraction

x3

x2

x y

x2 xy xy y2

The deletion–contraction algorithm applied to the diamond graph. Red edges are deleted in the left child and contracted in the rightchild. The resulting polynomial is the sum of the monomials at the leaves, x3 + 2x2 + y2 + 2xy + x + y . Based on Welsh &Merino (2000).

The deletion–contraction recurrence for the Tutte polynomial,

TG(x, y) = TG\e(x, y) + TG/e(x, y), ebridge. a nor loop a not

immediately yields a recursive algorithm for computing it: choose any such edge e and repeatedly apply the formulauntil all edges are either loops or bridges; the resulting base cases at the bottom of the evaluation are easy to compute.Within a polynomial factor, the running time t of this algorithm can be expressed in terms of the number of verticesn and the number of edges m of the graph,

t(n+m) = t(n+m− 1) + t(n+m− 2),

a recurrence relation that scales as the Fibonacci numbers with solution[15]

t(n+m) =

(1 +

√5

2

)n+m

= O(1.6180n+m

).

The analysis can be improved to within a polynomial factor of the number τ(G) of spanning trees of the inputgraph.[16] For sparse graphs with m = O(n) this running time is O(exp(n)) . For regular graphs of degree k, thenumber of spanning trees can be bounded by

Page 96: Computational Problems

24.6. COMPUTATIONAL COMPLEXITY 89

τ(G) = O(νnk n

−1 logn),

where

νk =(k − 1)k−1

(k2 − 2k)k2−1

.

so the deletion–contraction algorithm runs within a polynomial factor of this bound. For example:[17]

ν5 ≈ 4.4066.

In practice, graph isomorphism testing is used to avoid some recursive calls. This approach works well for graphsthat are quite sparse and exhibit many symmetries; the performance of the algorithm depends on the heuristic usedto pick the edge e.[18]

24.5.2 Gaussian elimination

In some restricted instances, the Tutte polynomial can be computed in polynomial time, ultimately because Gaussianelimination efficiently computes the matrix operations determinant and Pfaffian. These algorithms are themselvesimportant results from algebraic graph theory and statistical mechanics.TG(1, 1) equals the number τ(G) of spanning trees of a connected graph. This is computable in polynomial timeas the determinant of a maximal principal submatrix of the Laplacian matrix of G, an early result in algebraic graphtheory known as Kirchhoff’s Matrix–Tree theorem. Likewise, the dimension of the bicycle space at TG(−1,−1) canbe computed in polynomial time by Gaussian elimination.For planar graphs, the partition function of the Ising model, i.e., the Tutte polynomial at the hyperbola H2 , can beexpressed as a Pfaffian and computed efficiently via the FKT algorithm. This idea was developed by Fisher, Kasteleyn,and Temperley to compute the number of dimer covers of a planar lattice model.

24.5.3 Markov chain Monte Carlo

Using a Markov chain Monte Carlo method, the Tutte polynomial can be arbitrarily well approximated along thepositive branch of H2 , equivalently, the partition function of the ferromagnetic Ising model. This exploits the closeconnection between the Ising model and the problem of counting matchings in a graph. The idea behind this cele-brated result of Jerrum and Sinclair[19] is to set up a Markov chain whose states are the matchings of the input graph.The transitions are defined by choosing edges at random and modifying the matching accordingly. The resultingMarkov chain is rapidly mixing and leads to “sufficiently random” matchings, which can be used to recover the parti-tion function using random sampling. The resulting algorithm is a fully polynomial-time randomized approximationscheme (fpras).

24.6 Computational complexity

Several computational problems are associated with the Tutte polynomial. The most straightforward one is

Input A graph G

Output The coefficients of TG

In particular, the output allows evaluating TG(−2, 0) which is equivalent to counting the number of 3-colouringsof G. This latter question is #P-complete, even when restricted to the family of planar graphs, so the problem ofcomputing the coefficients of the Tutte polynomial for a given graph is #P-hard even for planar graphs.Much more attention has been given to the family of problems called Tutte (x, y) defined for every complex pair(x, y) :

Page 97: Computational Problems

90 CHAPTER 24. TUTTE POLYNOMIAL

Input A graph G

Output The value of TG(x, y)

The hardness of these problems varies with the coordinates (x, y) .

24.6.1 Exact computation

- 2 - 1 1 2 3 4x

- 2

- 1

1

2

3

4

y

The Tutte plane. Every point (x, y) in the real plane corresponds to a computational problem TG(x, y) . At any red point, theproblem is polynomial-time computable; at any blue point, the problem is #P-hard in general, but polynomial-time computable forplanar graphs; and at any point in the white regions, the problem is #P-hard even for bipartite planar graphs.

If both x and y are non-negative integers, the problem TG(x, y) belongs to #P. For general integer pairs, the Tuttepolynomial contains negative terms, which places the problem in the complexity class GapP, the closure of #P undersubtraction. To accommodate rational coordinates (x, y) , one can define a rational analogue of #P.[20]

The computational complexity of exactly computing TG(x, y) falls into one of two classes for any x, y ∈ C . Theproblem is #P-hard unless (x, y) lies on the hyperbola H1 or is one of the points

(1, 1), (−1,−1), (0,−1), (−1, 0), (i,−i), (−i, i),

(j, j2

),(j2, j

), j = e

2πi3 .

Page 98: Computational Problems

24.7. SEE ALSO 91

In which cases it is computable in polynomial time.[21] If the problem is restricted to the class of planar graphs, thepoints on the hyperbola H2 become polynomial-time computable as well. All other points remain #P-hard, even forbipartite planar graphs.[22] In his paper on the dichotomy for planar graphs, Vertigan claims (in his conclusion) thatthe same result holds when further restricted to graphs with vertex degree at most three, save for the point TG(0,−2), which counts nowhere-zero Z3-flows and is computable in polynomial time.[23]

These results contain several notable special cases. For example, the problem of computing the partition function ofthe Ising model is #P-hard in general, even though celebrated algorithms of Onsager and Fisher solve it for planarlattices. Also, the Jones polynomial is #P-hard to compute. Finally, computing the number of four-colourings of aplanar graph is #P-complete, even though the decision problem is trivial by the four colour theorem. In contrast, itis easy to see that counting the number of three-colourings for planar graphs is #P-complete because the decisionproblem is known to be NP-complete via a parsimonious reduction.

24.6.2 Approximation

The question which points admit a good approximation algorithm has been very well studied. Apart from the pointsthat can be computed exactly in polynomial time, the only approximation algorithm known for TG(x, y) is Jerrumand Sinclair’s FPRAS, which works for points on the “Ising” hyperbola H2 for y > 0. If the input graphs are restrictedto dense instances, with degree Ω(n) , there is an FPRAS if x ≥ 1, y ≥ 1.[24]

Even though the situation is not as well understood as for exact computation, large areas of the plane are known tobe hard to approximate.[20]

24.7 See also

Bollobás–Riordan polynomial

24.8 Notes[1] Chap. 10 in Bollobás (1998), chap. 13 in Biggs (1993), chap. 15 in Godsil & Royle (2004).

[2] cf. Sokal (2005)

[3] eq. (2.26) in Sokal (2005)

[4] Tutte (2004)

[5] Welsh

[6] See Farr (2007)

[7] Farr (2007)

[8] Welsh (1999)

[9] Las Vergnas (1980).

[10] Korn & Pak (2004), see also Korn & Pak (2003) for combinatorial interpretations of many other points

[11] Las Vergnas (1988)

[12] Welsh, Dominic (1993). Complexity: Knots, Colourings and Counting. London Mathematical Society Lecture Note Series.Cambridge University Press. p. 62. ISBN 978-0521457408.

[13] Welsh & Merino (2000)

[14] Martin, Pierre (1977). Enumérations Eulériennes dans les multigraphes et invariants de Tutte-Grothendieck [Eulerian Enu-merations in multigraphs and Tutte-Grothendieck invariants] (Thesis) (in French). Joseph Fourier University.

[15] Wilf (1986)

[16] Sekine, Imai & Tani (1995)

Page 99: Computational Problems

92 CHAPTER 24. TUTTE POLYNOMIAL

[17] Chung & Yau (1999), following Björklund et al. (2008)

[18] Sekine, Imai & Tani (1995), Imai (2000), Haggard, Pierce & Royle (2008)

[19] Jerrum & Sinclair (1993)

[20] Goldberg & Jerrum (2008)

[21] Jaeger, Vertigan & Welsh (1990)

[22] Vertigan & Welsh (1992)

[23] Vertigan, Dirk (2005). “The Computational Complexity of Tutte Invariants for Planar Graphs”. SIAM J. Comput. 35 (3):690–712. doi:10.1137/S0097539704446797.

[24] x ≥ 1, y = 1 is given by Annan (1994). x ≥ 1, y > 1 is given by Alon, Frieze & Welsh (1995)

24.9 References• Alon, N.; Frieze, A.; Welsh, D. J. A. (1995), “Polynomial time randomized approximation schemes for Tutte-

Gröthendieck invariants: The dense case”, Random Structures andAlgorithms 6 (4): 459–478, doi:10.1002/rsa.3240060409

• Annan, J. D. (1994), “A randomised approximation algorithm for counting the number of forests in densegraphs”, Combin. Prob. Comput. 3 (3): 273–283, doi:10.1017/S0963548300001188

• Biggs, Norman (1993), Algebraic Graph Theory (2nd ed.), Cambridge: Cambridge University Press, ISBN0-521-45897-8

• Björklund, Andreas; Husfeldt, Thore; Kaski, Petteri; Koivisto, Mikko (2008), “Computing the Tutte polyno-mial in vertex-exponential time”, Proceedings of the 47th annual IEEE Symposium on Foundations of ComputerScience, FOCS 2008: 677–686, doi:10.1109/FOCS.2008.40, ISBN 978-0-7695-3436-7

• Bollobás, Béla (1998), Modern Graph Theory, Berlin, New York: Springer-Verlag, ISBN 978-0-387-98491-9

• Crapo, Henry H. (1969). “The Tutte polynomial”. AequationesMathematicae 3: 211–229. doi:10.1007/bf01817442.

• Farr, Graham E. (2007), “Tutte-Whitney polynomials: some history and generalizations”, in Grimmett, Geof-frey; McDiarmid, Colin, Combinatorics, complexity, and chance. A tribute to Dominic Welsh, Oxford LectureSeries in Mathematics and its Applications 34, Oxford: Oxford University Press, pp. 28–52, ISBN 0-19-857127-5, Zbl 1124.05020

• Fortuin, Cees M.; Kasteleyn, Pieter W. (1972), “On the random-cluster model: I. Introduction and relation toother models”, Physica (Elsevier) 57 (4): 536–564, doi:10.1016/0031-8914(72)90045-6, ISSN 0031-8914

• Godsil, Chris; Royle, Gordon (2004), Algebraic Graph Theory, Berlin, New York: Springer-Verlag, ISBN978-0-387-95220-8

• Goldberg, L.A.; Jerrum, M. (2008), “Inapproximability of the Tutte polynomial”, Information and Computation206 (7): 908, doi:10.1016/j.ic.2008.04.003

• Jaeger, F.; Vertigan, D. L.; Welsh, D. J. A. (1990), “On the computational complexity of the Jones and Tuttepolynomials”, Mathematical Proceedings of the Cambridge Philosophical Society 108: 35–53, doi:10.1017/S0305004100068936

• Jerrum, M.; Sinclair, A. (1993), “Polynomial-time approximation algorithms for the Ising model”, SIAM J.Comput. 22 (5): 1087–1116, doi:10.1137/0222066

• Korn, M.; Pak, I. (2003), “Combinatorial evaluations of the Tutte polynomial”, Preprint

• Korn, M.; Pak, I. (2004), “Tilings of rectangles with T-tetrominoes”, Theor. Comp. Science 319: 3–27,doi:10.1016/j.tcs.2004.02.023

• Las Vergnas, Michel (1980), “Convexity in oriented matroids”, Journal of Combinatorial Theory, Series B 29(2): 231–243, doi:10.1016/0095-8956(80)90082-9, MR 586435

• Las Vergnas, Michel (1988), “On the evaluation at (3, 3) of the Tutte polynomial of a graph”, Journal ofCombinatorial Theory, Series B 35 (3): 367–372, doi:10.1016/0095-8956(88)90079-2, ISSN 0095-8956

Page 100: Computational Problems

24.10. EXTERNAL LINKS 93

• Sokal, Alan D. (2005), The multivariate Tutte polynomial (alias Potts model) for graphs and matroids, LondonMathematical Society Lecture Note Series 327, pp. 173–226, arXiv:math/0503607

• Tutte, W. T. (2001), Graph Theory, Cambridge University Press, ISBN 978-0521794893

• Tutte, W. T. (2004), “Graph-polynomials”, Advances in Applied Mathematics 32: 5–9, doi:10.1016/S0196-8858(03)00041-1

• Vertigan, D. L.; Welsh, D. J. A. (1992), “The Computational Complexity of the Tutte Plane: the BipartiteCase”, Combinatorics, Probability and Computing 1 (2): 181–187, doi:10.1017/S0963548300000195

• Welsh, D. J. A. (1976), Matroid Theory, Academic Press London, ISBN 012744050X

• Welsh, Dominic (1999), “The Tutte polynomial”, Random Structures & Algorithms (John Wiley & Sons, Inc.)15 (3–4): 210–228, doi:10.1002/(SICI)1098-2418(199910/12)15:3/4<210::AID-RSA2>3.0.CO;2-R, ISSN1042-9832

• Welsh, D. J. A.; Merino, C. (March 2000), “The Potts model and the Tutte polynomial”, Journal of Mathe-matical Physics 41 (3), doi:10.1063/1.533181

24.10 External links• Hazewinkel, Michiel, ed. (2001), “Tutte polynomial”, Encyclopedia of Mathematics, Springer, ISBN 978-1-

55608-010-4

• Weisstein, Eric W., “Tutte polynomial”, MathWorld.

• PlanetMath Chromatic polynomial

• Steven R. Pagano: Matroids and Signed Graphs

• Sandra Kingan: Matroid theory. Lots of links.

• Code for computing Tutte, Chromatic and Flow Polynomials by Gary Haggard, David J. Pearce and GordonRoyle:

Page 101: Computational Problems

Chapter 25

Unknotting problem

A tricky unknot diagram by Morwen Thistlethwaite

In mathematics, the unknotting problem is the problem of algorithmically recognizing the unknot, given some

94

Page 102: Computational Problems

25.1. COMPUTATIONAL COMPLEXITY 95

Another unknot

representation of a knot, e.g., a knot diagram. There are several types of unknotting algorithms. A major unresolvedchallenge is to determine if the problem admits a polynomial time algorithm, that is, whether the problem lies in thecomplexity class P.

25.1 Computational complexity

First steps toward determining the computational complexity were undertaken in proving that the problem is in largercomplexity classes, which contain the class P. By using normal surfaces to describe the Seifert surfaces of a givenknot, Hass, Lagarias & Pippenger (1999) showed that the unknotting problem is in the complexity class NP. Agol(2002) claimed that the problem of testing whether a knot has genus at least k (for a given number k) is in NP; thiswould imply that unknotting is in NP ∩ co-NP, but remains unpublished. Hara, Tani & Yamamoto (2005) claimed theweaker result that unknotting is in AM ∩ co-AM; however, later they retracted this claim.[1] In 2011, Greg Kuperbergproved that (assuming the generalized Riemann hypothesis) the unknotting problem is in co-NP.[2]

The unknotting problem has the same computational complexity as testing whether an embedding of an undirectedgraph in Euclidean space is linkless.[3]

25.2 Unknotting algorithms

Several algorithms solving the unknotting problem are based on Haken's theory of normal surfaces:

• Haken’s algorithm uses the theory of normal surfaces to find a disk whose boundary is the knot. Haken originallyused this algorithm to show that unknotting is decidable, but did not analyze its complexity in more detail.

Page 103: Computational Problems

96 CHAPTER 25. UNKNOTTING PROBLEM

• Hass, Lagarias, and Pippenger showed that the set of all normal surfaces may be represented by the integerpoints in a polyhedral cone and that a surface witnessing the unknottedness of a curve (if it exists) can alwaysbe found on one of the extreme rays of this cone. Therefore, vertex enumeration methods can be used to list allof the extreme rays and test whether any of them corresponds to a bounding disk of the knot. Hass, Lagarias,and Pippenger used this method to show that the unknottedness is in NP; later researchers such as Burton(2011a) refined their analysis, showing that this algorithm can be useful (though not polynomial time), with itscomplexity being a low-order singly-exponential function of the number of crossings.

• The algorithm of Birman & Hirsch (1998) uses braid foliations, a somewhat different type of structure than anormal surface. However to analyze its behavior they return to normal surface theory.

Other approaches include:

• The number of Reidemeister moves needed to change an unknot diagram to the standard unknot diagram is atmost exponential in the number of crossings.[4] Therefore, a brute force search for all sequences of Reidemeistermoves can detect unknottedness in doubly exponential time.

• Similarly, any two triangulations of the same knot complement may be connected by a sequence of Pachnermoves of length at most doubly exponential in the number of crossings.[5] Therefore, it is possible to determinewhether a knot is the unknot by testing all sequences of Pachner moves of this length, starting from the com-plement of the given knot, and determining whether any of them transforms the complement into a standardtriangulation of a solid torus. The time for this method would be triply exponential; however, experimentalevidence suggests that this bound is very pessimistic and that many fewer Pachner moves are needed.[6]

• Residual finiteness of the knot group (which follows from geometrization of Haken manifolds) gives an algo-rithm: check if the group has non-cyclic finite group quotient. This idea is used in Kuperberg’s result that theunknotting problem is in co-NP.

• Knot Floer homology of the knot detects the genus of the knot, which is 0 if and only if the knot is an unknot. Acombinatorial version of knot Floer homology allows it to be computed (Manolescu, Ozsváth & Sarkar 2009).

• Khovanov homology detects the unknot according to a result of Kronheimer and Mrowka.[7] The complexityof Khovanov homology at least as high as the #P-hard problem of computing the Jones polynomial, but it maybe calculated in practice using an algorithm and program of Bar-Natan (2007). Bar-Natan provides no rigorousanalysis of his algorithm, but heuristically estimates it to be exponential in the pathwidth of a crossing diagram,which in turn is at most proportional to the square root of the number of crossings.

Understanding the complexity of these algorithms is an active field of study.

25.3 See also• Algorithmic topology

• Unknotting number

25.4 Notes[1] Mentioned as a “personal communication” in reference [15] of Kuperberg (2014).

[2] Kuperberg (2014).

[3] Kawarabayashi, Kreutzer & Mohar (2010).

[4] Hass & Lagarias (2001).

[5] Mijatović (2005).

[6] Burton (2011b).

[7] Kronheimer & Mrowka (2010)

Page 104: Computational Problems

25.5. REFERENCES 97

25.5 References• Agol, Ian (2002), Knot genus is NP, web page with scanned talk slides.

• Bar-Natan, Dror (2007), “Fast Khovanov homology computations”, Journal of Knot Theory and Its Ramifica-tions 16 (3): 243–255, arXiv:math.GT/0606318, doi:10.1142/S0218216507005294, MR 2320156.

• Birman, Joan S.; Hirsch, Michael (1998), “A new algorithm for recognizing the unknot”, Geometry and Topol-ogy 2: 178–220, doi:10.2140/gt.1998.2.175.

• Burton, Benjamin A. (2011a), “Maximal admissible faces and asymptotic bounds for the normal surfacesolution space” (PDF), Journal of Combinatorial Theory, Series A 118 (4): 1410–1435, arXiv:1004.2605,doi:10.1016/j.jcta.2010.12.011, MR 2763065.

• Burton, Benjamin (2011b), “The Pachner graph and the simplification of 3-sphere triangulations”, Proc. 27thACMSymposium onComputational Geometry, pp. 153–162, arXiv:1011.4169, doi:10.1145/1998196.1998220.

• Haken, Wolfgang (1961), “Theorie der Normalflächen”, ActaMathematica 105: 245–375, doi:10.1007/BF02559591.

• Hara, Masao; Tani, Seiichi; Yamamoto, Makoto (2005), “Unknotting is in AM ∩ co-AM”, Proc. 16th ACM-SIAM Symposium on Discrete algorithms (SODA '05), pp. 359–364.

• Hass, Joel; Lagarias, Jeffrey C.; Pippenger, Nicholas (1999), “The computational complexity of knot and linkproblems”, Journal of the ACM 46 (2): 185–211, arXiv:math/9807016, doi:10.1145/301970.301971.

• Hass, Joel; Lagarias, Jeffrey C. (2001), “The number of Reidemeister moves needed for unknotting”, Journalof the American Mathematical Society 14 (2): 399–428, doi:10.1090/S0894-0347-01-00358-7, MR 1815217.

• Kawarabayashi, Ken-ichi; Kreutzer, Stephan; Mohar, Bojan (2010), “Linkless and flat embeddings in 3-spaceand the unknot problem”, Proc. ACM Symposium on Computational Geometry (SoCG '10), pp. 97–106,doi:10.1145/1810959.1810975.

• Kronheimer, Peter; Mrowka, Tomasz (2011), “Khovanov homology is an unknot-detector”, Publications Math-ématiques de l'IHÉS 113 (1): 97–208, arXiv:1005.4346, doi:10.1007/s10240-010-0030-y

• Kuperberg, Greg (2014), “Knottedness is in NP, modulo GRH”, Advances in Mathematics 256: 493–506,arXiv:1112.0845, doi:10.1016/j.aim.2014.01.007.

• Manolescu, Ciprian; Ozsváth, Peter S.; Sarkar, Sucharit (2009), “A combinatorial description of knot Floer ho-mology”, Annals ofMathematics, Second Series 169 (2): 633–660, arXiv:math/0607691, doi:10.4007/annals.2009.169.633,MR 2480614.

• Mijatović, Aleksandar (2005), “Simplicial structures of knot complements” (PDF), Mathematical ResearchLetters 12 (6): 843–856, arXiv:math/0306117, doi:10.4310/mrl.2005.v12.n6.a6

25.6 External links• Complexity Zoo provides information about complexity classes and their inclusion relations.

Page 105: Computational Problems

Chapter 26

Word problem (mathematics)

This article is about algorithmic word problems in mathematics and computer science. For other uses, see Wordproblem.

In mathematics and computer science, a word problem for a set S with respect to a system of finite encodings of itselements is the algorithmic problem of deciding whether two given representatives represent the same element of theset. The problem is commonly encountered in abstract algebra, where given a presentation of an algebraic structureby generators and relators, the problem is to determine if two expressions represent the same element; a prototypicalexample is the word problem for groups. Less formally, the word problem in an algebra is: given a set of identitiesE, and two expressions x and y, is it possible to transform x into y using the identities in E as rewriting rules in bothdirections? While answering this question may not seem hard, the remarkable (and deep) result that emerges, in manyimportant cases, is that the problem is undecidable.Many, if not most all, undecidable problems in mathematics can be posed as word problems; see the list of undecidableproblems for many examples.

26.1 Background and motivation

Many occasions arise in mathematics where one wishes to use a finite amount of information to describe an elementof a (typically infinite) set. This issue is particularly apparent in computational mathematics. Traditional models ofcomputation (such as the Turing machine) have storage capacity which is unbounded, so it is in principle possible toperform computations with the elements of infinite sets. On the other hand, since the amount of storage space in useat any one time is finite, we need each element to have a finite representation.For various reasons, it is not always possible or desirable to use a system of unique encodings, that is, one in whichevery element has a single encoding. When using an encoding system without uniqueness, the question naturallyarises of whether there is an algorithm which, given as input two encodings, decides whether they represent the sameelement. Such an algorithm is called a solution to the word problem for the encoding system.

26.2 The word problem in combinatorial calculus

Main article: Combinatory logic § Undecidability of combinatorial calculus

The simplest example of an undecidable word problem occurs in combinatory logic: when are two strings of com-binators equivalent? Because combinators encode all possible Turing machines, and the equivalence of two Turingmachines is undecidable, it follows that the equivalence of two strings of combinators is undecidable.Likewise, one has essentially the same problem in lambda calculus: given two distinct lambda expressions, there isno algorithm which can discern whether they are equivalent or not; equivalence is undecidable.

98

Page 106: Computational Problems

26.3. THE WORD PROBLEM IN UNIVERSAL ALGEBRA 99

26.3 The word problem in universal algebra

In algebra, one often studies infinite algebras which are generated (under the finitary operations of the algebra) byfinitely many elements. In this case, the elements of the algebra have a natural system of finite encoding as expressionsin terms of the generators and operations. The word problem here is thus to determine, given two such expressions,whether they represent the same element of the algebra.Roughly speaking, the word problem in an algebra is: given a set E of identities (an equational theory), and two termss and t, is it possible to transform s into t using the identities in E as rewriting rules in both directions?.[1] A properextension of the word problem is known as the unification problem (a.k.a. as equation solving problem). While theformer asks whether two terms are equal, the latter asks whether they have instances that are equal. As a commonexample, " 2 + 3

?=8 + (−3) " is a word problem in the integer group ℤ, while " 2 + x

?=8 + (−x) " is a unification

problem in the same group; since the former terms happen to be equal in ℤ, the latter problem has the substitutionx 7→ 3 as a solution.Substitutions may be ordered into a partial order, thus, unification is the act of finding a join on a lattice. In this sense,the word problem on a lattice has a solution, namely, the set of all equivalent words is the free lattice.One of the most deeply studied cases of the word problem is in the theory of semigroups and groups. There aremany groups for which the word problem is not decidable, in that there is no Turing machine that can determine theequivalence of two arbitrary words in a finite time.The word problem on ground terms is not decidable.[2]

The word problem on free Heyting algebras is difficult.[3] The only known results are that the free Heyting algebraon one generator is infinite, and that the free complete Heyting algebra on one generator exists (and has one moreelement than the free Heyting algebra).

26.4 Example: A term rewriting system to decide the word problem in thefree group

Bläsius and Bürckert [4] demonstrate the Knuth–Bendix algorithm on an axiom set for groups. The algorithm yieldsa confluent and noetherian term rewrite system that transforms every term into a unique normal form.[5] The rewriterules are numbered incontiguous since some rules became redundant and were deleted during the algorithm run. Theequality of two terms follows from the axioms if and only if both terms are transformed into literally the same normalform term. For example, the terms

((a−1 · a) · (b · b−1))−1R2(1 · (b · b−1))−1R13 (1 · 1)−1R11−1R81

b · ((a · b)−1 · a)R17 b · ((b−1 · a−1) · a)R3b · (b−1 · (a−1 · a))R2b · (b−1 · 1)R11 b · b−1R13 1

share the same normal form, viz. 1 ; therefor both terms are equal in every group. As another example, the term1 · (a · b) and b · (1 ·a) has the normal form a · b and b ·a , respectively. Since the normal forms are literally different,the original terms cannot be equal in every group. In fact, they are usually different in non-abelian groups.

26.5 See also

• Munn tree

• Word problem for groups

• Knuth–Bendix completion algorithm

• Unification (computer science)

Page 107: Computational Problems

100 CHAPTER 26. WORD PROBLEM (MATHEMATICS)

26.6 References[1] Franz Baader and Tobias Nipkow, Term Rewriting and All That, Cambridge University Press, 1998, p. 5

[2] Yuri Matijasevich, (1967) “Simple examples of undecidable associative calculi”, Soviet Mathematics Doklady 8(2) pp 555–557.

[3] Peter T. Johnstone, Stone Spaces, (1982) Cambridge University Press, Cambridge, ISBN 0-521-23893-5. (See chapter 1,paragraph 4.11)

[4] K. H. Bläsius and H.-J. Bürckert, ed. (1992). Deduktionsssysteme. Oldenbourg. p. 291. ; here: p.126, 134

[5] Apply rules in any order to a term, as long as possible; the result doesn't depend on the order; it is the term’s normal form.

Page 108: Computational Problems

26.7. TEXT AND IMAGE SOURCES, CONTRIBUTORS, AND LICENSES 101

26.7 Text and image sources, contributors, and licenses

26.7.1 Text• AI-complete Source: https://en.wikipedia.org/wiki/AI-complete?oldid=647053275 Contributors: Tobias Hoevekamp, Bryan Derksen,

Michael Hardy, JakeVortex, Karada, Dcoetzee, Phil Boswell, Kevin Saff, Beland, Rich Farmbrough, Chalst, GregorB, Rjwilmsi, ErikHau-gen, Hairy Dude, CarlHewitt, Darker Dreams, Eskimbot, Rizzardi, MisterHand, Last Avenue, Byelf2007, Pgr94, Yuzz, PhilKnight,Magioladitis, A3nm, Adamdaley, VolkovBot, Davehi1, Chimpex, Jamelan, Etm3, CharlesGillingham, Dlrohrer2003, Auntof6, Wik-Head, Kbdankbot, Legobot, Yobot, AnomieBOT, Jim1138, Twri, Xqbot, Sophus Bie, Thehelpfulbot, Citation bot 1, RobinK, David290,Untalker, Ngocminh.oss, FakirNL, EagerToddler39, Tenured, Bethcarey and Anonymous: 32

• Art gallery problem Source: https://en.wikipedia.org/wiki/Art_gallery_problem?oldid=614497808 Contributors: Angela, Dcoetzee, Al-tenmann, Giftlite, Bender235, Arthena, Oleg Alexandrov, Justinlebar, Stochata, Wknight94, CWenger, HereToHelp, Ilmari Karonen,AndrewWTaylor, JennyRad, Mhym, Deditos, Jamie King, Josephorourke, Vanish2, Eerdemir, David Eppstein, Rocchini, Addbot, DOIbot, Luckas-bot, Amirobot, Freikorp, Erel Segal, Citation bot, Twri, ArthurBot, 0g1o2i3k4e5n6, D'ohBot, Citation bot 1, Helano, God-friedToussaint, ZéroBot, ClueBot NG, Dic.azuosed, Helpful Pixie Bot and Anonymous: 11

• Circuit satisfiability problem Source: https://en.wikipedia.org/wiki/Circuit_satisfiability_problem?oldid=638909784Contributors: TheAnome, Eclecticos, Lim Wei Quan, R'n'B, Aaron Rotenberg, Yobot, AnomieBOT, BattyBot, Brirush, Znazari and Anonymous: 2

• Computational problem Source: https://en.wikipedia.org/wiki/Computational_problem?oldid=669331125 Contributors: Edward, ,דודTobias Bergemann, Creidieki, BD2412, Qwertyus, Sloman, Pascal.Tesson, David Eppstein, R'n'B, One Night In Hackney, Legoktm,Tonkawa68, DumZiBoT, Addbot, Favonian, Tcshasaposse, Pcap, JRB-Europe, Twri, Xqbot, Miym, FrescoBot, LucienBOT, Rigaudon,RobinK, FalseAxiom, ZéroBot, Helpful Pixie Bot, Blamelooseradiolabel, PIerre.Lescanne and Anonymous: 12

• Computing the permanent Source: https://en.wikipedia.org/wiki/Computing_the_permanent?oldid=664367627 Contributors: MichaelHardy, McKay, Altenmann, Giftlite, Xezbeth, Zaslav, Shreevatsa, Ruziklan, Rjwilmsi, Mukadderat, Headbomb, Hermel, David Eppstein,Laudak, Bender2k14, Kbdankbot, Yobot, Kilom691, AnomieBOT, Citation bot, Twri, Thore Husfeldt, Citation bot 1, RjwilmsiBot,Circularargument, Helpful Pixie Bot, Gregory Kogan, Ynaamad and Anonymous: 17

• Counting problem (complexity) Source: https://en.wikipedia.org/wiki/Counting_problem_(complexity)?oldid=663513073 Contribu-tors: Michael Hardy, Altenmann, CryptoDerk, Icairns, Creidieki, ReyBrujo, Ruud Koot, NekoDaemon, Oerjan, David Eppstein, Pcap,AnomieBOT, RobinK, 777sms, Widr and Anonymous: 1

• Covering problems Source: https://en.wikipedia.org/wiki/Covering_problems?oldid=612758978 Contributors: Michael Hardy, CharlesMatthews, Giftlite, Jeremykemp, Ericbodden, Gaius Cornelius, Sardanaphalus, JonHarder, Ylloh, Hermel, David Eppstein, The ThingThat Should Not Be, Mild Bill Hiccup, Addbot, PV=nRT, Luckas-bot, Erel Segal and RobinK

• Decision problem Source: https://en.wikipedia.org/wiki/Decision_problem?oldid=670722196Contributors: AxelBoldt, LC~enwiki, Seb,Cwitty, Stevertigo, Chinju, Kragen, Salsa Shark, Ehn, Iseeaboar, Dcoetzee, Hyacinth, Pakaran, David.Monniaux, Kuszi, MathMartin,Hadal, Sho Uemura, Tobias Bergemann, Giftlite, Uday, Inkling, Dratman, Mellum, Philgp, Gdr, Creidieki, MementoVivere, Ascánder,Paul August, Nortexoid, Giraffedata, Obradovic Goran, Arthena, Sligocki, Culix, MIT Trekkie, Oleg Alexandrov, Unixxx, Linas, Shree-vatsa, Jonathan de Boyne Pollard, Mandarax, Kesla, Krymson, NekoDaemon, Chobot, Wavelength, UsaSatsui, SmackBot, Od Mishehu,Pro8, Kurykh, Lambiam, Wvbailey, JoseREMY, Lalaith, Drae, Jafet, Ylloh, CRGreathouse, CBM, Baiji, Gregbard, Cydebot, Uber-ScienceNerd, Hazmat2, Noroton, Dougher, Objectivesea, SalvNaut, David Eppstein, Eiji adachi~enwiki, Anchor Link Bot, ClueBot,UKoch, Pichpich, Addbot, Bfigura’s puppy, Yobot, Pcap, VladimirReshetnikov, RobinK, Igor Yalovecky, Dlakavi, Sigma0 1, Rmashhadi,MerlIwBot, MusikAnimal, TheJJJunk, KasparBot and Anonymous: 45

• Dining philosophers problem Source: https://en.wikipedia.org/wiki/Dining_philosophers_problem?oldid=666016163Contributors: TheAnome, Andre Engels, Detritus, Mrwojo, Steverapaport, Bdesham, Nommonomanac, PhilipMW, Michael Hardy, Rp, TakuyaMurata,Dori, Minesweeper, Egil, Haakon, Snoyes, Julesd, Cyan, Poor Yorick, Evercat, Charles Matthews, Dysprosia, Wik, Silvonen, Samsara,Jni, Aenar, RickBeton, Robbot, Donreed, Chocolateboy, Tobias Bergemann, ManuelGR, Giftlite, Dbenbenn, BenFrantzDale, Lee J Hay-wood, Zumbo, Pcalcado, AlistairMcMillan, Bigpeteb, Lanzm~enwiki, DanielZM, Gcanyon, Gazpacho, Mike Rosoft, Rich Farmbrough,Kdammers, Chairboy, Sietse Snel, Chriscf, Bobo192, Jumbuck, Tobych, A.T.M.Schipperijn, Wtmitchell, Sh1mmer, Alai, Markaci, Bo-brayner, LOL, Gimboid13, Allen3, Graham87, Jcmo, Grblpi, FlaBot, Fresheneesz, Tardis, Alvin-cs, Gregstoll, Hairy Dude, RussBot,NawlinWiki, Cleared as filed, Bestofmed, Waqas1987, Voidxor, Zwobot, Gorgonzilla, Theda, Mebden, AndrewWTaylor, SmackBot,Martin.Budden, Adam Mirowski, GraemeMcRae, Da Vynci, Krallja, FiftyNine, Thisisbossi, Allan McInnes, Bigmantonyd, Thomasyen,Ligulembot, Euchiasmus, PseudoSudo, Bajamircea, Tawkerbot2, Vanisaac, Bobman312, Cydebot, Euphues, Sytelus, Thrapper, Epbr123,Towopedia, 49oxen, Lklundin, JAnDbot, Shaul1, BlueRobot~enwiki, Nyttend, SquidSK, Drm310, Gwern, Alsee, ShoWPiece, AsafSh,Singularitarian, Maduskis, Pixeleditor, Juliancolton, Beezhive, Mcclarke, BigDunc, Khvalamde, Faithlessthewonderboy, DavePercy, TheThing That Should Not Be, DnetSvg, Trivialist, Alexbot, Cacadril, DeltaQuad, Muro Bot, IMneme, Alexguev, Addbot, Yuanyelele, Ash-ton1983, Pnacitum, Tide rolls, Lightbot, Yobot, Calle, Götz, Jim1138, Sz-iwbot, Citation bot, Sunapi386, Xqbot, Capricorn42, Nasnema,RibotBOT, Shadowjams, Djplayer123, FrescoBot, Ebegoli, Gerby123, Fozziethebeat, RobinK, Tuplanolla, Jfmantis, Digi123, MadsBo-geskov, ZéroBot, Careful! They're ruffled!, Mlucius, ClueBot NG, SebulbaChip, Loopy48, Hofmic, Widr, Mydarkside, Helpful PixieBot, Shrutishetty, BG19bot, IluvatarBot, Chmarkine, Ducknish, Webclient101, Jamesde0919227, AmericanJedi001, RotlinkBot, I amOne of Many, MaskedHero, Jianhui67, WikiJuggernaut, WustlStudent, Moddagudu, Peturb, RuedigerMoeller, Vykrex and Anonymous:267

• Dutch national flag problem Source: https://en.wikipedia.org/wiki/Dutch_national_flag_problem?oldid=668974279 Contributors: Al-tenmann, Beland, OverlordQ, Andreas Kaufmann, Mike Rosoft, Ledrug, Ruud Koot, GregorB, Qwertyus, RussBot, Froth, Crocoite,Rwalker, Frap, Nakon, Joffeloff, Sinaloa, Eastlaw, Pierre de Lyon, Widefox, Clan-destine, Thomasda, Svick, Pvdl, Toarunshukla, Su-persid01, Nd tim, Yobot, SvartMan, FrescoBot, Multigenerator, ClueBot NG, Parimalapriyaa, Ardahal.nitw, Amahule, Christian Matt,BG19bot, Sander.v.Ginkel, ChrisGualtieri, Dtrupenn, PIerre.Lescanne, Ruharish, Chadparry, Ketavn and Anonymous: 31

• Function problem Source: https://en.wikipedia.org/wiki/Function_problem?oldid=670927074Contributors: MathMartin, Gdr, Tubedogg,Ben Standeven, EmilJ, Culix, Batztown, Chobot, Melchoir, Radagast83, Deefje, Cramerica, Pascal.Tesson, Alphachimpbot, Andre.holzner,Huzzlet the bot, LokiClock, TXiKiBoT, Addbot, Pcap, Erik9bot, RobinK, Mastergreg82, Helpful Pixie Bot, BG19bot, Mathmon andAnonymous: 9

Page 109: Computational Problems

102 CHAPTER 26. WORD PROBLEM (MATHEMATICS)

• Gap reduction Source: https://en.wikipedia.org/wiki/Gap_reduction?oldid=639179149 Contributors: Trappist the monk, BG19bot,Goalbox, Npinsker and Infinitestory

• Josephus problem Source: https://en.wikipedia.org/wiki/Josephus_problem?oldid=674702113Contributors: Michael Hardy, Jitse Niesen,Jogloran, AnonMoos, Phil Boswell, Robinh, Giftlite, Adashiel, Mormegil, Craig Schamp, Crisófilax, Helopticor, Joriki, GregorB, Mas-terzora, DrHow, Maxal, Chobot, Crazytales, Trovatore, Sycthos, Chiok, Eloy, Mooncow, Radagast83, Cybercobra, Ashwinkumar b v,Bocianski, Hebrides, Thijs!bot, Ty683g542, Alphachimpbot, Wasell, Fuzzyllama, Andre.holzner, KOTEHOK, Rachelskit, Yonidebot,Lantonov, Amadaeus1010011010, Ptrillian, Philip Trueman, TXiKiBoT, Crowborough, AlleborgoBot, John Shaffer, Toddst1, Hariva,ClueBot, BOTarate, XLinkBot, PL290, Addbot, Favonian, Lightbot, PV=nRT, Bluebusy, Luckas-bot, Matthias Kupfer, Angel ivanovangelov, Hairhorn, ArthurBot, Cantons-de-l'Est, GrouchoBot, Courtgoing, Napx, Poliocretes, RedBot, RobinK, Sintau.tayua, Begoon,MDMCP, LcawteHuggle, EmausBot, Eniagrom, ClueBot NG, LutherVinci, Gleannnangealt, BattyBot, Me nishant, Tow, Vikas.veshishth,Niskand, Markunit23, Conovaloff, Yelnatz, Richard Kohar and Anonymous: 69

• Linear search problem Source: https://en.wikipedia.org/wiki/Linear_search_problem?oldid=661986336Contributors: Furrykef, Crasshop-per, Chris the speller, Decltype, WhaleyTim, David Eppstein, TrulyBlue, Yobot, AnomieBOT, Shuroo, Tom3118, RobinK, BG19bot,Swikish and Anonymous: 8

• List of PPAD-complete problems Source: https://en.wikipedia.org/wiki/List_of_PPAD-complete_problems?oldid=533364058 Con-tributors: Zeno Gantner, ,דוד Rich Farmbrough, EmilJ, Rjwilmsi, Kintali, Idiotwithastick, Tassedethe, Ipatrol, Erik9bot, Citation bot 1,RobinK, Paul.w.goldberg, RjwilmsiBot, Pyschobbens and Anonymous: 4

• N-body problem Source: https://en.wikipedia.org/wiki/N-body_problem?oldid=676039691 Contributors: AxelBoldt, Mav, Bryan Derk-sen, Zundark, The Anome, Gareth Owen, Khendon, PierreAbbat, Heron, Stevertigo, Nealmcb, Patrick, Michael Hardy, Geoffrey~enwiki,Eric119, Looxix~enwiki, Stevenj, Ideyal, Revolver, Dying, Charles Matthews, Reddi, Jitse Niesen, Doradus, Saltine, Itai, Finlay McWal-ter, Jaredwf, Fredrik, MathMartin, Hadal, Wikibot, Wereon, Robinh, Xanzzibar, Cyrius, Giftlite, Gene Ward Smith, Wolfkeeper, Ja-cob1207, Curps, CyborgTosser, Murison, Pascal666, Wmahan, Gugganij, Neilc, CryptoDerk, Abu badali, LucasVB, Fpahl, Beland,Urhixidur, Masudr, Pjacobi, Smyth, Paul August, Bender235, Tompw, RJHall, Pt, Wareh, Aaron D. Ball, Jpceayene, Apostrophe, Espoo,Alansohn, Jeltz, Avenue, Joris Gillis, RJFJR, Gene Nygaard, Oleg Alexandrov, Linas, Benhocking, GregorB, Dmitry Gerasimov~enwiki,Waldir, SeventyThree, Marudubshinki, Graham87, Rjwilmsi, MarSch, BlueMoonlet, Nneonneo, Bubba73, Mathbot, Gurch, Woodardj,Kri, Nsteinberg, Chobot, Bgwhite, YurikBot, Hairy Dude, 4C~enwiki, Bjf, Zwobot, Denis Constales, Ingling, ClaesWallin, Urger48400,Tsiaojian lee, Bo Jacoby, That Guy, From That Show!, SmackBot, Oub, InverseHypercube, K-UNIT, CrypticBacon, Septegram, Gaff,Kmarinas86, Jayanta Sen, Kostmo, Tamfang, Chlewbot, Mr Snrub, Somnlaut, Mistamagic28, Agradman, Ourai, EdC~enwiki, Novange-lis, Freelance Intellectual, Olaf Davis, Mattbuck, Yaris678, Stebbins, A876, WillowW, Dimacq, Michael C Price, Tewapack, Jauricchio,Nisselua, Mattva01, Spartaz, Barek, Coolhandscot, MegX, Engelbaet, Swpb, Gwern, David J Wilson, CommonsDelinker, Vanderbei, HuTotya, Hans Dunkelberg, ChrisfromHouston, Dispenser, Tarotcards, Michaelban, Sdommers~enwiki, TXiKiBoT, Jacob Lundberg, RedAct, MusicScience, PaulTanenbaum, Suriel1981, Timothy Cooper, Paolo.dL, Mangledorf, Anchor Link Bot, JL-Bot, Kjkatusc, ClueBot,PixelBot, Cr7i, Cuz183, Togaen, DumZiBoT, YouRang?, Terry0051, LuciferJ, Addbot, The Equilibrium, Canrosin, Anders Sandberg,Protonk, 84user, Lightbot, Wmrwiki, Yobot, Fraggle81, AnomieBOT, ThaddeusB, Piano non troppo, Csigabi, Constructive editor, Gli-derMaven, Keen Commander, Lookhigh, Parvons, Tom.Reding, Double sharp, Puzl bustr, Duoduoduo, Diannaa, Olawlor, Math+Wine,EmausBot, Tuankiet65, Dewritech, Kristian Larsen, Sk!d, Mmeijeri, Dcirovic, ZéroBot, BrokenAnchorBot, Maschen, Zfeinst, Tea-peat, Llightex, Morgis, ClueBot NG, Anagogist, Chrisminter, Moneya, Ernest3.141, Bibcode Bot, BG19bot, Camrto, Negativecharge,Northamerica1000, 155blue, Jobojobocat, Mogism, Rudrene, Mark viking, Jrmrjnck, Smirglis, Abitslow, KasparBot and Anonymous:129

• Optimization problem Source: https://en.wikipedia.org/wiki/Optimization_problem?oldid=669670966Contributors: The Anome, MichaelHardy, Charles Matthews, Altenmann, Giftlite, Mellum, Rich Farmbrough, Obradovic Goran, Diego Moya, Culix, Lensovet, Rjwilmsi,Wavelength, Bota47, SmackBot, J. Finkelstein, Hermel, R'n'B, Nono64, Trumpet marietta 45750, SieBot, Jan Winnicki, Rinconsoleao,C. lorenz, Addbot, Pcap, Xqbot, Anne Bauval, Isheden, Citation bot 1, RobinK, Waeswaes, Іванко1, Sigma0 1, Shengzhongxie, HelpfulPixie Bot, Rouhollah.Kazimi, ,طاها KasparBot, Ahmadian.jalil and Anonymous: 21

• Promise problem Source: https://en.wikipedia.org/wiki/Promise_problem?oldid=662978153 Contributors: ,דוד Phil Boswell, Cryp-toDerk, Eldar, Shreevatsa, NekoDaemon, Dialectric, Ott2, Kungfuadam, David Eppstein, Addbot, Legobot II, Pcap, Miym, RobinK,Flamerecca, YFdyh-bot, Jeffrey Bosboom and Anonymous: 1

• Search problem Source: https://en.wikipedia.org/wiki/Search_problem?oldid=641894184 Contributors: Michael Hardy, CryptoDerk,Creidieki, LuckyStarr, Xezbeth, Emallove, NekoDaemon, SmackBot, Easwarno1, CzarB, R'n'B, SpaceLana, Addbot, Pcap, AnomieBOT,Shuroo, RobinK, 777sms, ClueBot NG, Dfarrell07, ChrisGualtieri, Ngshoy, Dancingtubas, Ohwaah, Asr85 and Anonymous: 6

• Set splitting problem Source: https://en.wikipedia.org/wiki/Set_splitting_problem?oldid=674050408Contributors: Altenmann, Rjwilmsi,Niceguyedc, C. lorenz, Kbdankbot, Addbot, RPHv, Xqbot, Frietjes and Anonymous: 5

• Sharp-P-completeness of 01-permanent Source: https://en.wikipedia.org/wiki/Sharp-P-completeness_of_01-permanent?oldid=642166667Contributors: Michael Hardy, Charles Matthews, Mackensen, Altenmann, Giftlite, 4pq1injbok, Diego Moya, Kusma, Shreevatsa, Om-nieiunium, Tznkai, Arthur Rubin, SmackBot, Karmastan, ForgeGod, Took, Aram.harrow, Bluebot, Ppadala, OrphanBot, Fuhghettaboutit,Mukadderat, Ylloh, CRGreathouse, Hardmath, Jayron32, Joachim Selke, David Eppstein, Lantonov, Nsk92, Laudak, Kbdankbot, Deep-math, Twri, Thore Husfeldt, Citation bot 1, T. Canens, Torceval, Cobaltcigs, SporkBot, Macwhiz, Deltahedron and Anonymous: 17

• Sharp-SAT Source: https://en.wikipedia.org/wiki/Sharp-SAT?oldid=654526096 Contributors: Michael Hardy, Sadads, Bender2k14,Dekart, Addbot, StokeMasterJack, RedZiz~enwiki, RobinK, ZéroBot and Anonymous: 2

• Sum of radicals Source: https://en.wikipedia.org/wiki/Sum_of_radicals?oldid=491962068 Contributors: Michael Hardy, Giftlite, Joriki,David Eppstein, DFRussia, Citation bot, Twri, Citation bot 1, RobinK, Helpful Pixie Bot and Anonymous: 1

• Tutte polynomial Source: https://en.wikipedia.org/wiki/Tutte_polynomial?oldid=667628147Contributors: Michael Hardy, Charles Matthews,Giftlite, Lang rabbie, Paul August, Zaslav, Pt, UrsusArctos, Joriki, Rjwilmsi, Siddhant, SmackBot, Gutworth, Euchiasmus, Ni fr, JLean-der, Skylian, Ylloh, Luther driggers, CRGreathouse, CmdrObot, CBM, Hannes Eder, Changbao, Stdazi, David Eppstein, Koko90, Poli-cron, KylieTastic, Davidp314, JackSchmidt, Svick, Darnedfrenchman, Mild Bill Hiccup, Bender2k14, Leen Droogendijk, AnomieBOT,Citation bot, Twri, LilHelpa, Alex Dainiak, Miym, Thore Husfeldt, G.perarnau, Citation bot 1, RobinK, Haaninjo, NinaSofia, Bomazi,Brad7777, ChrisGualtieri, Sudochris, Deltahedron and Anonymous: 29

Page 110: Computational Problems

26.7. TEXT AND IMAGE SOURCES, CONTRIBUTORS, AND LICENSES 103

• Unknotting problem Source: https://en.wikipedia.org/wiki/Unknotting_problem?oldid=676101406 Contributors: Michael Hardy, Hy-acinth, Sam nead, Puffinry, C S, Greg Kuperberg, Danhash, Rjwilmsi, Dylan Thurston, SmackBot, Hermel, Vanish2, David Eppstein,Rybu, Yzarc314, Yobot, AnomieBOT, Citation bot, PigFlu Oink, RobinK, Jupiterberry, Debouch and Anonymous: 7

• Word problem (mathematics) Source: https://en.wikipedia.org/wiki/Word_problem_(mathematics)?oldid=638820252 Contributors:Zundark, Jitse Niesen, Tobias Bergemann, Cambyses, Beland, Redvers, Oleg Alexandrov, Linas, GregorB, HannsEwald, RussBot, RobertA West, JonHarder, Huon, Jokes Free4Me, Gerry Ashton, Nick Number, AntiVandalBot, Bobby Hardtime, Maurice Carbonaro, Hi012345678910,VolkovBot, Hans Adler, Pichpich, Addbot, Legobot, Yobot, Pcap, AnomieBOT, Charvest, RobinK, Slawekb, BattyBot, The Illusive Man,Jochen Burghardt, Cuddlyface and Anonymous: 8

26.7.2 Images• File:Ambox_important.svg Source: https://upload.wikimedia.org/wikipedia/commons/b/b4/Ambox_important.svg License: Public do-

main Contributors: Own work, based off of Image:Ambox scales.svg Original artist: Dsmurat (talk · contribs)• File:Art_gallery_problem.svg Source: https://upload.wikimedia.org/wikipedia/commons/e/ee/Art_gallery_problem.svg License: CC

BY 3.0 Contributors: Own work Original artist: Claudio Rocchini• File:Chromatic_in_the_Tutte_plane.jpg Source: https://upload.wikimedia.org/wikipedia/en/0/02/Chromatic_in_the_Tutte_plane.jpg

License: CC-BY-SA-1.0 Contributors:I created this work entirely by myself.Original artist:Thore Husfeldt (talk)

• File:Crab_Nebula.jpg Source: https://upload.wikimedia.org/wikipedia/commons/0/00/Crab_Nebula.jpg License: Public domain Con-tributors: HubbleSite: gallery, release. Original artist: NASA, ESA, J. Hester and A. Loll (Arizona State University)

• File:Decision_Problem.svg Source: https://upload.wikimedia.org/wikipedia/commons/0/06/Decision_Problem.svgLicense: GFDLCon-tributors: Derivative work based on http://en.wikipedia.org/wiki/File:Decision_Problem.png Original artist: RobinK

• File:Deletion-contraction.svg Source: https://upload.wikimedia.org/wikipedia/en/5/5d/Deletion-contraction.svg License: CC-BY-SA-3.0 Contributors:I created this work entirely by myself.Original artist:Thore Husfeldt (talk)

• File:Dining_philosophers.png Source: https://upload.wikimedia.org/wikipedia/commons/6/6a/Dining_philosophers.png License: CCBY-SA 3.0 Contributors: Created by bdesham using OmniGraffle; post-processed in GraphicConverter. I used some other Commonsimages to make this one: Original artist: Benjamin D. Esham (bdesham)

• File:Edit-clear.svg Source: https://upload.wikimedia.org/wikipedia/en/f/f2/Edit-clear.svg License: Public domain Contributors: TheTango! Desktop Project. Original artist:The people from the Tango! project. And according to the meta-data in the file, specifically: “Andreas Nilsson, and Jakub Steiner (althoughminimally).”

• File:Flag_of_the_Netherlands.svg Source: https://upload.wikimedia.org/wikipedia/commons/2/20/Flag_of_the_Netherlands.svg Li-cense: Public domain Contributors: Own work Original artist: Zscout370

• File:Flow_in_the_Tutte_plane.jpg Source: https://upload.wikimedia.org/wikipedia/en/4/4b/Flow_in_the_Tutte_plane.jpgLicense: CC-BY-SA-3.0 Contributors:I created this work entirely by myself.Original artist:Thore Husfeldt (talk)

• File:Jones_in_the_Tutte_plane.jpg Source: https://upload.wikimedia.org/wikipedia/en/1/19/Jones_in_the_Tutte_plane.jpg License:CC-BY-SA-3.0 Contributors:I created this work entirely by myself.Original artist:Thore Husfeldt (talk)

• File:Kipler’s_Error.jpg Source: https://upload.wikimedia.org/wikipedia/commons/1/13/Kipler%27s_Error.jpg License: CC BY-SA3.0 Contributors: Own work Original artist: Rudrene

• File:N-body_problem_(3).gif Source: https://upload.wikimedia.org/wikipedia/commons/f/f9/N-body_problem_%283%29.gifLicense:Public domain Contributors: ? Original artist: ?

• File:Nuvola_apps_edu_mathematics_blue-p.svg Source: https://upload.wikimedia.org/wikipedia/commons/3/3e/Nuvola_apps_edu_mathematics_blue-p.svg License: GPL Contributors: Derivative work from Image:Nuvola apps edu mathematics.png and Image:Nuvolaapps edu mathematics-p.svg Original artist: David Vignoni (original icon); Flamurai (SVG convertion); bayo (color)

• File:Ochiai_unknot.svg Source: https://upload.wikimedia.org/wikipedia/commons/3/32/Ochiai_unknot.svg License: CC-BY-SA-3.0Contributors: en:Image:Ochiai unknot.png Original artist: en:User:C S (original); Pbroks13 (talk) (redraw)

• File:Permanent-2powers01.png Source: https://upload.wikimedia.org/wikipedia/en/f/f0/Permanent-2powers01.png License: PD Con-tributors: ? Original artist: ?

• File:Permanent-Nonneg2Powers.png Source: https://upload.wikimedia.org/wikipedia/en/4/4a/Permanent-Nonneg2Powers.pngLicense:PD Contributors: ? Original artist: ?

• File:Polyhedron_with_no_vertex_visible_from_center.png Source: https://upload.wikimedia.org/wikipedia/commons/6/62/Polyhedron_with_no_vertex_visible_from_center.png License: Public domain Contributors: Self-made using POV-Ray 3.6 for Windows. Originalartist: Ilmari Karonen

Page 111: Computational Problems

104 CHAPTER 26. WORD PROBLEM (MATHEMATICS)

• File:Potts_and_Ising_in_the_Tutte_plane.jpg Source: https://upload.wikimedia.org/wikipedia/en/2/29/Potts_and_Ising_in_the_Tutte_plane.jpg License: CC-BY-SA-1.0 Contributors:I created this work entirely by myself.Original artist:Thore Husfeldt (talk)

• File:Question_book-new.svg Source: https://upload.wikimedia.org/wikipedia/en/9/99/Question_book-new.svg License: Cc-by-sa-3.0Contributors:Created from scratch in Adobe Illustrator. Based on Image:Question book.png created by User:Equazcion Original artist:Tkgd2007

• File:Reliability_in_the_Tutte_plane.jpg Source: https://upload.wikimedia.org/wikipedia/en/8/81/Reliability_in_the_Tutte_plane.jpgLicense: CC-BY-SA-3.0 Contributors:I created this work entirely by myself.Original artist:Thore Husfeldt (talk)

• File:Restricted_3-Body_1.jpg Source: https://upload.wikimedia.org/wikipedia/commons/9/97/Restricted_3-Body_1.jpg License: CCBY-SA 3.0 Contributors: Own work Original artist: Rudrene

• File:Stylised_Lithium_Atom.svg Source: https://upload.wikimedia.org/wikipedia/commons/e/e1/Stylised_Lithium_Atom.svgLicense:CC-BY-SA-3.0 Contributors: based off of Image:Stylised Lithium Atom.png by Halfdan. Original artist: SVG by Indolences. Recoloringand ironing out some glitches done by Rainer Klute.

• File:Thistlethwaite_unknot.svg Source: https://upload.wikimedia.org/wikipedia/commons/9/98/Thistlethwaite_unknot.svgLicense: Pub-lic domain Contributors: en:Image:Thistlethwaite unknot.png Original artist: Traced by User:Stannered

• File:Tractable_points_of_the_Tutte_polynomial_in_the_real_plane.svg Source: https://upload.wikimedia.org/wikipedia/commons/5/53/Tractable_points_of_the_Tutte_polynomial_in_the_real_plane.svgLicense: CC BY-SA 3.0Contributors: Mathematica source code:Original artist: Self

• File:Triangulation_3-coloring.svg Source: https://upload.wikimedia.org/wikipedia/commons/c/c2/Triangulation_3-coloring.svgLicense:Public domain Contributors: Own work Original artist: David Eppstein

• File:Tutte_polynomial_and_chromatic_polynomial_of_the_Bull_graph.jpg Source: https://upload.wikimedia.org/wikipedia/en/7/76/Tutte_polynomial_and_chromatic_polynomial_of_the_Bull_graph.jpg License: CC-BY-SA-3.0 Contributors:I created this work entirely by myself.Original artist:Thore Husfeldt (talk)

26.7.3 Content license• Creative Commons Attribution-Share Alike 3.0