Name the upper graph triangle's vertices , where is adjacent to and to . Name the middle left vertex and the lower right vertex . Then is adjacent to , the lower graph triangle is , and is adjacent to .
Suppose all have colour , while has a different colour ; denote the third colour by . In the upper graph triangle, and cannot have colour and are adjacent, so they have colours in some order and has colour . In the lower graph triangle, is adjacent to both and , forcing to have colour , and then must have colour . But the edge now has equal-coloured endpoints, a contradiction. Thus
For the three-colour clause gadget used in a reduction, one also needs the converse extension property for Boolean-coloured inputs. With and , every tuple other than extends. If , take ; this works regardless of . If , take . Finally, if , take . Each assignment satisfies every edge. Therefore this three-colour clause gadget realizes exactly a three-input disjunction on Boolean inputs.
The three-colourability problem belongs to NP: a colour assignment is a polynomial-length complexity certificate, and all edges can be checked in time.
For NP-hardness, reduce 3-SAT to the three-colourability problem. Start with a palette graph triangle with vertices . Its colours are necessarily distinct, and name them by these vertices. For each Boolean variable , add vertices , join them to each other, and join each to . The graph triangle is the forcing component of the Boolean-pair colouring gadget, so the two literal vertices receive opposite colours .
For each Boolean clause, attach a fresh copy of the three-colour clause gadget, identify its with the palette vertex , and identify its three input vertices with the Boolean clause's Boolean literal vertices. Copies share only palette or literal vertices. A Boolean clause with one or two Boolean literals is padded to three by repeating a literal; an empty Boolean clause can be mapped immediately to the uncolourable graph .
Any graph colouring with three colours gives a truth assignment by reading colour as true. The three-colour clause gadget forbids three false inputs, so every Boolean clause is satisfied. Conversely, any satisfying truth assignment colours the literal pairs, and the extension property proved above independently colours the fresh auxiliary vertices of each clause. Thus the entire graph is three-colourable exactly when the formula is satisfiable.
There are vertices for variables and nonempty padded clauses, and edges. The construction is a polynomial-time many-one reduction. Using the permitted NP-completeness of 3-SAT, we obtain
This decision problem asks whether a finite undirected graph has a graph colouring with three colours. It is NP-complete: a colouring certifies membership in NP, while 3-SAT reduces using Boolean-pair colouring gadgets and three-colour clause gadgets.