Lights Out on graphs

We model the Lights Out game on general simple graphs in the framework of linear algebra over the field F2\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathbb{F}_{2}$$\end{document}. Based upon a version of the Fredholm alternative, we introduce a separating invariant of the game, i.e., an initial state can be transformed into a final state if and only if the values of the invariant of both states agree. We also investigate certain states with particularly interesting properties. Apart from the classical version of the game, we propose several variants, in particular a version with more than only two states (light on, light off), where the analysis relies on systems of linear equations over the ring Zn\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathbb{Z}_{n}$$\end{document}. Although it is easy to find a concrete solution of the Lights Out problem, we show that it is NP-hard to find a minimal solution. We also propose electric circuit diagrams to actually realize the Lights Out game.


Introduction
The game Lights Out exists in several versions.The classical edition, issued by Tiger Electronics in 1995, consists of a 5 × 5 grid of lights which are switches at the same time.Pressing a light will toggle the state of this light and its adjacent neighbors between off and on.Initially a random set of lights are on and the aim is to turn all lights off, if possible with a minimum number of operations.This game and some variants of it have been studied several times in the literature: The classical problem as described above was modeled in the language of linear algebra in [1].In [3] the puzzle on a 2 k × 2 k torus is investigated, and a criterion for the solvability of the 5 k × 5 k torus is derived.In [4] the solvability of the Lights Out game with respect to varying board size and with more than one color (see Section 4.4 below) is studied by methods from algebraic number theory.In the present paper, we consider the Lights Out game and some variants on general graphs.
We can play the game with the rules described above on an arbitrary simple graph G with vertex set V := {v 1 , . . ., v n }.Each vertex is a light and at the same time a switch.The status of the lights is modeled by a map V → F 2 = {0, 1}, represented by a vector (x 1 , . . ., x n ) ⊤ , where x i = 1 means that the light in vertex v i is on, and off if x i = 0. Let A ∈ F n×n 2 be the adjacency matrix of G. Then N := A + I, where I is the n × n identity matrix, encodes the information about which lights are toggled when pushing a certain button: If x ∈ F n 2 represents a state of lights and we press switch v j , then the resulting state will be x where e j is the j-th column of I, and where the operations in (1) are carried out in the field F 2 .Hence, pressing a sequence of switches, say v j1 , v j2 , . . ., v j k , will lead an initial state x ∈ F n 2 to the resulting state x + N e j1 + N e j2 + . . .+ N e j k = x + N (e j1 + e j2 + . . .+ e j k ).
In particular, • the order in which switches are pushed does not play a role, and • pressing a switch an even number of times is equivalent to not touching it at all.
Hence, for an initial state i ∈ F n 2 of lights, a given final state f ∈ F n 2 can be reached in the Lights Out game if and only if there exists a ∈ F n 2 such that f = i + N a.Here, a = (a 1 , a 2 , . . ., a n ) ⊤ encodes the concrete solution: To get from i to f we push all switches v j for which a j = 1.

A separating invariant for the Lights Out game on graphs
As we have seen in the introduction, a final state f ∈ F n 2 can be reached from an initial state i ∈ F n 2 if and only if i + f belongs to the column space of N .This observation can conveniently be expressed by introducing the following equivalence relation: Definition 1. Two elements x, y ∈ F n 2 are called equivalent with respect to the matrix N ∈ F n×n 2 (or just equivalent) if x + y lies in the column space of N .In this case we write x ∼ y.
Hence, an initial state i ∈ F n 2 can be transformed into a final state f ∈ F n 2 if and only if i ∼ f .In principal, it is now easy to check, if i and f belong to the same equivalence class by applying Gauss elimination in F 2 for the linear system N a = i + f .However, if we want to see at a glance whether i ∼ f , we need a handy separating invariant.In order to formulate such an invariant, we first define a bilinear form on x, m = 0 for all m ∈ M } is a vector space.Note however, that the bilinear form •, • is not positive definite: Every x ∈ F n 2 with an even number of ones satisfies x, x = 0 (such vectors are called isotropic).Nonetheless, the Fredholm alternative holds in the following sense: be an m × n matrix.Then the linear system N x = b has a solution x ∈ F n 2 if and only if b ∈ F m 2 is orthogonal to all solutions of the adjoint system N ⊤ y = 0. I.e., there holds ( On the other hand, as above, we get for the dimension of Thus, by ( 2) and (3) the two vector spaces im N and (ker N ⊤ ) ⊥ agree.
In the theory of linear codes, Proposition 3 is formulated as C ⊥⊥ = C: a code C coincides with its double-dual code.be the matrix with rows v ⊤ 1 , . . ., v ⊤ n−r .Then x → Jx is a separating invariant for the Lights Out game on G: An initial state i can be transformed into a final state f if and only if Ji = Jf .In particular, all lights can be turned off if and only if Ji = 0.

Now we apply
Proof.As we have seen above, i can be transformed into f if and only if i + f ∈ im N .According to Proposition 3 this is equivalent to the fact, that i + f is orthogonal to ker N , which in turn means that J(i + f ) = 0.And over F 2 this is equivalent to Ji = Jf .
3 Special states

Inverting a state
Let x ∈ F n 2 describe a state in the Light Out game.Then we say that x := x + (1, 1, . . ., 1) ⊤ is the inverse state: Lights which are on in x are off in x and vice versa.Now, we claim that in the Lights Out game every state can be inverted: Theorem 5. Let G be an arbitrary simple graph and x an initial state.Then, x can be transformed into its inverse state x.
In order to prove Theorem 5 we start with the following Lemma: Lemma 6.Let N ∈ F n×n 2 be symmetric with all diagonal elements N ii = 1.Then, each x ∈ ker N is isotropic.
Proof.Let x ∈ ker N .We have to show, that the number of components x i of x which are equal to 1 is even.Let Ω = {j | x j = 1} and N (i) denote the i-th Taking the sum over i ∈ Ω in (4) we get, by the symmetry of N , The first term on the right hand side of ( 5) is card(Ω) mod 2 because all diagonal elements of N equal 1, the second term is zero in F 2 .Hence x is isotropic.
Let Θ = {v j1 , . . ., v j k } be a set of buttons which, when pressed, invert a state.Such a set will be called inverting set.Hence, if x ∈ F n 2 is a vector with ones at the coordinates j 1 , . . ., j k and zeros at all other coordinates, there holds N x = (1, . . ., 1) ⊤ .Such a vector will be called inverting.
Remark.Theorem 5 is optimal in the sense that for the complete graph K n , we have dim(im N ) = 1.Indeed, on K n inverting a state is the only possible operation.

Self-reproducing, self-avoiding and neutral vectors
Is it possible, starting from all lights off, to press a certain set of buttons such that exactly those lights are turned on?Such a self-reproducing set Θ = {v j1 , . . ., v j k } corresponds to a self-reproducing vector x ∈ F n 2 having ones exactly at the coordinates j ℓ , ℓ = 1, . . ., k, and zeros in all other coordinates, such that N x = (A + I)x = x.Hence we have the following: 2 is self-reproducing on the graph G with adjacency matrix A if and only if Ax = 0. Is it possible, starting from all lights off, to press a certain set of buttons such that exactly all other lights are turned on?Such a self-avoiding set Θ = {v j1 , . . ., v j k } corresponds to a self-avoiding vector x ∈ F n 2 having ones exactly at the coordinates j ℓ , ℓ = 1, . . ., k, and zeros in all other coordinates, such that N x = (A + I)x = x = x + (1, . . ., 1) ⊤ .Hence we have: 2 is self-avoiding on the graph G with adjacency matrix A if and only if Ax = (1, . . ., 1) ⊤ .
Next we are looking for a set of lights Θ = {v j1 , . . ., v j k } with the following property: If the lights in Θ are on and all others are off, and if then all buttons in Θ are pushed, then again exactly the lights in Θ are supposed to be on.Such a neutral set Θ = {v j1 , . . ., v j k } corresponds to a neutral vector x ∈ F n 2 having ones exactly at the coordinates j ℓ , ℓ = 1, . . ., k, and zeros in all other coordinates, such that x = x + N x = x + (A + I)x, i.e.N x = 0 or equivalently Ax = x.Proposition 9. A vector x ∈ F n 2 is neutral on the graph G with adjacency matrix A if and only if Ax = x.
In other words, pressing the buttons which correspond to a neutral vector x has no effect since x = x + 0 = x + N x.From these considerations we conclude immediately: Proposition 10.
• The sum of an even number of self-avoiding vectors is self-reproducing.
• The sum of an arbitrary number of self-reproducing vectors is self-reproducing.
• The sum of an arbitrary number of neutral vectors is neutral.
• The sum of a self-avoiding vector and an arbitrary number of self-reproducing vectors is self-avoiding.
• The sum of a neutral vector and a sum of an even number of inverting vectors is neutral.

Variants of the game 4.1 The Second Neighbors Lights Out game
Here, we change the rules of the game a little bit to create a new challenge.Let G be a simple graph with the property, that either every vertex has even degree or zero degree, or every vertex has odd degree.In the first case every row of the adjacency matrix A is isotropic.On this graph, we play the Lights Out game as follows: If we push a button v i , the corresponding light is inverted and also the second neighbors.However, if a vertex v k is connected with v i by an even number of paths of length 2, then v k keeps its status.We call this game the Second Neighbors Lights Out game.We find: be the adjacency matrix of a simple graph G such that (a) all vertices have even degree or zero degree, and r is the rank of N := A 2 + I, or (b) all vertices have odd degree, and r is the rank of N := A 2 .
Let v 1 , . . ., v n−r be a basis of ker N and J ∈ F

The Neighborhood Lights Out game
Here, we mix the original and the Second Neighbors Lights Out game: Let G be a simple graph such that either every vertex has odd degree, or every vertex has even degree or zero degree.On this graph, we play the game as follows: If we push a button v i , the corresponding light is inverted, its direct neighbors and also the second neighbors.As before, if a vertex v k is connected with v i by an even number of paths of lengths 1 or 2, then v k keeps its status.We call this game the Neighborhood Lights Out game.For this game we have: The Neighborhood Lights Out game on G is equivalent to the original Lights Out game on Ḡ.Thus, an initial state i can be transformed into a final state f in the Neighborhood Lights Out game on G if and only if i + f belongs to the column space of N .But im(N + N 2 ) ⊂ im N , and hence i can be transformed into f in the original Lights Out game on G if this is possible on Ḡ.

The Non-reflexive Lights Out game
Suppose, your Lights Out game device does not function properly anymore: You notice that some of the buttons v i (maybe all) invert only their direct neighbors but no longer the light in v i .This means that on the diagonal of the original matrix N = A + I, some places turned from 1 to 0. Hence the game is described by a new matrix N = A + Ī, where Ī ∈ F n×n 2 is a given diagonal matrix.
It is clear that Theorem 4 with N replaced by N remains true for this version of the game.However, Theorem 5 turns into the following: Theorem 15.Let G be a simple graph with adjacency matrix A, and N = A+ Ī, where Ī ∈ F n×n 2 is diagonal.Then, Ī(1, 1, . . ., 1) ⊤ belongs to the column space of N .I.e., if i, f ∈ F n 2 are such that i + f = Ī(1, 1, . . ., 1) ⊤ , then the initial state i can be transformed into the final state f .In particular, if all lights are turned off initially, the state Ī(1, 1, . . ., 1) ⊤ can be reached.
Proof.Let d = ( N11 , N22 , . . ., Nnn ) ⊤ = Ī(1, . . ., 1) ⊤ be the vector consisting of the diagonal entries of N and x ∈ ker N be an element of the kernel of N .Then, we have Thus, d is orthogonal to all elements x ∈ ker N , which is, according to Proposition 3 and in view of the symmetry of the matrix N , equivalent to d ∈ im( N ).

The Colored Lights Out game
We consider again a simple graph G with n vertices and with adjacency matrix A. Instead of toggling between on and off, we may consider a cycle We encode the colors by their numbers, and off by 0. Hence a state of colored lights on G corresponds to a vector (x 1 , . . ., x n ) ⊤ ∈ Z n k , where x i indicates the color of the light in vertex v i .Pushing a button in vertex v i will increment the color in v i and its neighbors by one, modulo k.Suppose we push a i -times the button in v i , i = 1, . . ., n, then an initial state i ∈ Z n k of colored lights on the graph will end up in the final state f = i + N a, where a = (a 1 , . . ., a n ) ⊤ and the operations are carried out in Z k , and where N = A + I.This means, we have to solve the linear system where c = f − i.We first treat the simpler case where k is squarefree.
2. Let k i := k/p i and use the extended Euclidean algorithm to find r i , s i ∈ Z such that r i p i + s i k i = 1 for each i.Then a solution of ( 6) is given by In particular, a solution of (6) exists if and only if det N ≡ 0 mod p i for all i ∈ {1, . . ., ℓ}.
Proof.Observe that s i k i ≡ 1 mod p i and s i k i ≡ 0 mod p j for all j = i.Therefore we have modulo for all j ∈ {1, . . ., ℓ}, and the claim follows by the Chinese Remainder theorem.
For the general case of an arbitrary k ∈ N, we first observe, that (6) can equivalently be written as where M := (N | kI) is the n × 2n-matrix with N in the left block and kI in the right block, and where ā is the vector with first n components a and n additional (unknown) integer components below.Then (7), and hence (6), can be solved as follows: Proposition 17.Let U M V = B be the Smith decomposition of M , i.e., U ∈ Z n×n and V ∈ Z 2n×2n are unimodular matrices, and B ∈ Z n×2m is the Smith normal form of M .Let y be an integer solution of By = U c.Then, ā = V y solves (7), and in particular, the first n components of ā solve (6).Moreover, (7) has a solution if and only if B ii divides the i-th component of U c for all i.
Proof.The proof follows immediately from the properties of the Smith decomposition.

The asymmetric Lights Out game
Here we play the game on a directed graph G: If a certain button is pressed the corresponding light toggles and also the lights in all of its out-neighbors.The adjacency matrix A ∈ F n×n 2 of G is in this case in general not symmetric: A jk = 1 if j is the foot and k is the head of a directed edge, 0 otherwise.
We put again N = A + I.If i ∈ F n 2 is an initial state and f ∈ F n 2 a final state, then i can be transformed into f if and only if f = i + N ⊤ a for some a ∈ F n 2 , i.e., if i + f belongs to the column space of N ⊤ .But then, according to Proposition 3, im N ⊤ = (ker N ) ⊥ , and therefore Theorem 4 remains true for the Lights Out game on the directed graph G.

The problem of finding minimal solutions
The questions we encountered so far could easily be answered by standard tools of linear algebra: E.g. to determine whether an initial state i can be transformed into a final state f for the Lights Out game is answered by the separating invariant from Theorem 4: This requires only to compute a matrix multiplication J(i + f ) and to check if the result is the zero vector.Similarly, to actually compute a solution for this problem, we just apply Gauss elimination to solve the linear system N a = i + f for a over F 2 .However, it turns out that finding minimal solutions is computationally much more difficult.For example we have: Proposition 18.The problem of finding a self-reproducing vector x = 0 in Proposition 7 of minimal Hamming weight is NP-hard.
Proof.Recall that a self-reproducing vector x is characterized by the equation Ax = 0, where A is the adjacency matrix of the graph G.Such a vector x corresponds to a vertex set V ′ = {v j1 , . . ., v j ℓ } ⊂ V with v j k ∈ V ′ ⇐⇒ x j k = 1 which has the property that every vertex v ∈ V has an even number of vertices of V ′ (or none of them) among its neighbors.This translates into the following decision problem: Even Vertex Set Instance: A graph G = (V, E) and an integer w > 0. Question: Is there a nonempty subset V ′ ⊂ V of at most w vertices, such that every vertex v ∈ V has an even number of vertices of V ′ among its neighbors?
It has been shown by Vardy [5] that the Even Vertex Set problem is NPcomplete.To find a vector x with Ax = 0 and minimal Hamming weight is therefore NP-hard.
As a second example, we take a closer look at the problem of finding a minimal solution to the Non-reflexive Lights Out game with N = A (see Section 4.3), i.e., a solution with a minimum buttons pressed.Suppose our graph has n vertices.As we have seen above, to transform an initial state i ∈ F n 2 into a final state f ∈ F n 2 we need to solve the linear system Aa = i + f over F 2 for a ∈ F n 2 .If the matrix rank of A over F 2 is n, the solution a is unique.However, in general, r := rank A < n and the set of solutions (if non-empty) forms an affine space A of dimension n − r > 0 in F n 2 .To find a solution with a minimum number of buttons to push means to find a vector in A with minimum Hamming weight.We will show, that this problem is NP-hard.The reasoning is based upon the result of Berlekamp, McEliece and van Tilborg who showed in [2] that the nearest codeword problem is NP-complete: Nearest Codeword Problem Instance: A binary m × n matrix A, a binary vector y ∈ F m 2 , and an integer w > 0. Question: Is there a vector x ∈ F n 2 of Hamming weight ≤ w such that Ax = y?
We first show that the special case of a square matrix A is not easier than the general problem: If the rank of A is r < n, this indicates that one has to go over all of the 2 n−r points in the affine space defined by Ax = i + f to determine a minimal solution of the Non-reflexive Lights Out game.

Circuit diagrams of the Lights Out game
It is far from obvious how a classical electric circuit with voltage source, lamps and switches can be built which realizes the Lights Out game.We propose such a circuit diagram for the cycle graph C n with n ≥ 3 vertices.To this end, consider the following building block B k : The output of the or-gate is connected to the clock input of the T flip-flop T i .The button B i of vertex v i is then connected to • an input pin of the corresponding or-gate (see figure above), and • an input pin of the or-gate of every neighboring vertex of v i .
In this way, pushing the button B i toggles the outputs Q i and the outputs of all neighboring vertices.

Lights Out on graphs with symmetries
Let G = (V, E) be a graph with vertex set V = {v 1 , . . ., v n } and edge set E = {e 1 , . . ., e k }, where each edge e ℓ is the set {v i , v j } of the two vertices which are incident with it.An automorphism of G is a bijective map φ : V → V such that {φ(v i ), φ(v j )} ∈ E ⇐⇒ {v i , v j } ∈ E.
Prominent examples of graphs with a nontrivial automorphism group are Cayley graphs: Let G be a finite group and S ⊂ G be a symmetric subset, i.e., with each s ∈ S, also the inverse s −1 ∈ S. The Cayley graph Γ(G, S) has as vertices the elements g ∈ G and the edges are {{g, gs} : g ∈ G, s ∈ S}.If we assume in addition, that S does not contain the unit element of G, the resulting graph has no loops, and is therefore suitable for the Lights Out game.Observe that G is a subgroup of the automorphism group of the Cayley graph Γ(G, S).In fact, each h ∈ G induces an automorphism of Γ(G, S) by G → G, g → hg.Indeed, the edge {g, gs} is mapped to the edge {(hg), (hg)s}.
The symmetries of a graph allow to map a special state of the Lights Out game from Section 3 into a similar one by applying an automorphism of the graph: Proposition 22.Let φ be an automorphism of a graph.Then there holds: (a) If J is an inverting set, then φ(J) is an inverting set.
(b) If J is a self-avoiding set, then φ(J) is a self-avoiding set.
(c) If J is a self-reproducing set, then φ(J) is a self-reproducing set.
(d) If J is a neutral set, then φ(J) is a neutral set.
Proof.(a) Let x ∈ F n 2 be the vector with ones at the coordinates which correspond to elements of J, and y = P ⊤ x the vector with ones at the coordinates which correspond to elements of φ(J).J is inverting if and only if N x = (1, . . ., 1) ⊤ .By putting x = P P ⊤ x we get, after multiplying the previous equation from the left by P ⊤ , the identity

2 and get: Theorem 4 .
Proposition 3 in our case to the symmetric matrix N = N ⊤ ∈ F n×n Let A ∈ F n×n 2 be the adjacency matrix of a simple graph G and N := A + I with rank r.Let v 1 , . . ., v n−r be a basis of ker N and J ∈ F (n−r)×n 2

Proof.
Part (a) follows from Theorem 5 applied to the graph Ḡ in the proof of Theorem 11.To prove part (b) we argue as follows: Let again A be the adjacency matrix of G, and N := A + I. If, as in the proof of Theorem 11, Ā = A 2 denotes the adjacency matrix of Ḡ, we have N := Ā + I = A 2 + I = N 2 .Recall that the Second Neighbors Lights Out game on G is equivalent to the original Lights Out game on Ḡ.Thus, an initial state i can be transformed into a final state f in the Second Neighbors Lights Out game on G if and only if i + f belongs to the column space of N .But im N 2 ⊂ im N , and hence i can be transformed into f in the original Lights Out game on G if this is possible on Ḡ.

2
be the adjacency matrix of a simple graph G such that • all vertices have odd degree, and r is the rank of N := A + A 2 , or • all vertices have even degree or zero degree, and r is the rank of N := A + A 2 + I.Let v 1 , . . ., v n−r be a basis of ker N and J ∈ F (n−r)×n 2 be the matrix with rows v ⊤ 1 , . . ., v ⊤ n−r .Then x → Jx is a separating invariant for the Neighborhood Lights Out game on G: An initial state i can be transformed into a final state f if and only if Ji = Jf .Proof.In case (a) the Neighborhood Lights Out game is equivalent to the original Lights Out game, but on a new simple graph Ḡ with adjacency matrix Ā := A + A 2 + I. Since all vertices of G have odd degree the elements on the diagonal of Ā are 0, and hence Ḡ has no loops.Let N = Ā+I = A+A 2 .Then, the claim follows from Theorem 4 applied to Ḡ. Similarly in case (b), Ā = A + A 2 is the adjacency matrix of a simple graph Ḡ.Hence, with N = Ā + I = A + A 2 + I, the claim follows from Theorem 4 applied to Ḡ.Moreover, we have Theorem 14.(a) Every state in the Neighborhood Lights Out game on G can be inverted.(b) If every vertex of G has odd degree, then the following ist true: If an initial state i can be transformed into a final state f in the Neighborhood Lights Out game on G, then this is also possible for the original Lights Out game on G. Proof.Part (a) follows from Theorem 5 applied to the graph Ḡ in the proof of Theorem 13.For part (b) let again A be the adjacency matrix of G and N := A + I. Then Ā = A+A 2 +I is the adjacency matrix of Ḡ, and N := Ā+I = A+A 2 = N +N 2 .

•
, and D k to d k+1 , for k = 1, . . ., n − 1, and close the cycle by connecting A n and a 1 , B n and b 1 , C n and c 1 , and D n and d 1 .Then, the quadrupole changeover switch in block B k will invert the lamps ℓ k , ℓ k+1 and ℓ k+2 cyclically.An initial state can be arranged by changing, if necessary, the contacts of the switch next to each lamp.Using a circuit diagram with boolean gates gives more flexibility.In this case, the building blocks are T flip-flops: Whenever a clock pulse at C arrives, the output state Q, Q = ¬Q toggles.To build the Lights Out game, we are going to use only the Q output which will represent the lamp: Q = 1 corresponds to light on, Q = 0 corresponds to light off.To implement the Lights Out game on an arbitrary graph, we represent every vertex v i by the following circuit element: or
An initial state i can be transformed into a final state f if and only if Ji = Jf .Proof.Observe, that the Second Neighbors Lights Out game is equivalent to the original Lights Out game, but on a new simple graph Ḡ with adjacency matrix Ā := A 2 in case (a).It is at this point where we need the fact, that all rows of A are isotropic: This implies that all elements on the diagonal of A 2 are 0, which means that indeed Ḡ has no loops.Let N = Ā + I = A 2 + I.Then, the claim follows from Theorem 4 applied to Ḡ. Similarly in case (b) Ā = A 2 + I is the adjacency matrix of a simple graph Ḡ.Hence, if we put N = Ā + I = A 2 , then the claim follows from Theorem 4 applied to Ḡ as above.
r)×n 2 be the matrix with rows v ⊤ 1 , . . ., v ⊤ n−r .Then x → Jx is a separating invariant for the Second Neighbors Lights Out game on G: Moreover, we have Theorem 12. (a) Every state in the Second Neighbors Lights Out game on G can be inverted.(b) If all vertices of G have even degree or zero degree, then the following is true: If an initial state i can be transformed into a final state f in the Second Neighbors Lights Out game on G, then this is also possible for the original Lights Out game on G.
Nearest Codeword Problem Instance: A binary n × n matrix A, a binary vector y ∈ F n Lemma 19.The Balanced Nearest Codeword Problem is NP-complete.Proof.It is easy to see that the Balanced Nearest Codeword Problem is in NP.We will now show that the General Nearest Codeword Problem can be reduced The corresponding computational problem for the Non-reflexive Lights Out game is the following: Theorem 21.The Non-reflexive Lights Out game Problem is NP-complete.Hence, to find a solution of the Non-reflexive Lights Out game Problem with a minimal number of pressed buttons is NP-hard.