A logical matrix, binary matrix, relation matrix, Boolean matrix, or (0, 1)-matrix is a
matrix
Matrix (: matrices or matrixes) or MATRIX may refer to:
Science and mathematics
* Matrix (mathematics), a rectangular array of numbers, symbols or expressions
* Matrix (logic), part of a formula in prenex normal form
* Matrix (biology), the m ...
with entries from the
Boolean domain
In mathematics and abstract algebra, a Boolean domain is a set consisting of exactly two elements whose interpretations include ''false'' and ''true''. In logic, mathematics and theoretical computer science, a Boolean domain is usually written ...
Such a matrix can be used to represent a
binary relation
In mathematics, a binary relation associates some elements of one Set (mathematics), set called the ''domain'' with some elements of another set called the ''codomain''. Precisely, a binary relation over sets X and Y is a set of ordered pairs ...
between a pair of
finite set
In mathematics, particularly set theory, a finite set is a set that has a finite number of elements. Informally, a finite set is a set which one could in principle count and finish counting. For example,
is a finite set with five elements. Th ...
s. It is an important tool in
combinatorial mathematics and
theoretical computer science
Theoretical computer science is a subfield of computer science and mathematics that focuses on the Abstraction, abstract and mathematical foundations of computation.
It is difficult to circumscribe the theoretical areas precisely. The Associati ...
.
Matrix representation of a relation
If ''R'' is a
binary relation
In mathematics, a binary relation associates some elements of one Set (mathematics), set called the ''domain'' with some elements of another set called the ''codomain''. Precisely, a binary relation over sets X and Y is a set of ordered pairs ...
between the finite
indexed sets ''X'' and ''Y'' (so ), then ''R'' can be represented by the logical matrix ''M'' whose row and column indices index the elements of ''X'' and ''Y'', respectively, such that the entries of ''M'' are defined by
:
In order to designate the row and column numbers of the matrix, the sets ''X'' and ''Y'' are indexed with positive
integer
An integer is the number zero (0), a positive natural number (1, 2, 3, ...), or the negation of a positive natural number (−1, −2, −3, ...). The negations or additive inverses of the positive natural numbers are referred to as negative in ...
s: ''i'' ranges from 1 to the
cardinality
The thumb is the first digit of the hand, next to the index finger. When a person is standing in the medical anatomical position (where the palm is facing to the front), the thumb is the outermost digit. The Medical Latin English noun for thum ...
(size) of ''X'', and ''j'' ranges from 1 to the cardinality of ''Y''. See the article on
indexed sets for more detail.
The
transpose
In linear algebra, the transpose of a Matrix (mathematics), matrix is an operator which flips a matrix over its diagonal;
that is, it switches the row and column indices of the matrix by producing another matrix, often denoted by (among other ...
of the logical matrix
of a binary relation corresponds to the
converse relation
In mathematics, the converse of a binary relation is the relation that occurs when the order of the elements is switched in the relation. For example, the converse of the relation 'child of' is the relation 'parent of'. In formal terms ...
.
Example
The binary relation ''R'' on the set is defined so that ''aRb'' holds if and only if ''a''
divides
In mathematics, a divisor of an integer n, also called a factor of n, is an integer m that may be multiplied by some integer to produce n. In this case, one also says that n is a '' multiple'' of m. An integer n is divisible or evenly divisibl ...
''b'' evenly, with no remainder. For example, 2''R''4 holds because 2 divides 4 without leaving a remainder, but 3''R''4 does not hold because when 3 divides 4, there is a remainder of 1. The following set is the set of pairs for which the relation ''R'' holds.
:.
The corresponding representation as a logical matrix is
:
which includes a diagonal of ones, since each number divides itself.
Other examples
* A
permutation matrix
In mathematics, particularly in matrix theory, a permutation matrix is a square binary matrix that has exactly one entry of 1 in each row and each column with all other entries 0. An permutation matrix can represent a permutation of elements. ...
is a (0, 1)-matrix, all of whose columns and rows each have exactly one nonzero element.
** A
Costas array
In mathematics, a Costas array can be regarded geometry, geometrically as a set of ''n'' points, each at the center of a square in an ''n''×''n'' square tiling such that each row or column contains only one point, and all of the ''n''(''n''& ...
is a special case of a permutation matrix.
* An
incidence matrix in
combinatorics
Combinatorics is an area of mathematics primarily concerned with counting, both as a means and as an end to obtaining results, and certain properties of finite structures. It is closely related to many other areas of mathematics and has many ...
and
finite geometry has ones to indicate incidence between points (or vertices) and lines of a geometry, blocks of a
block design
In combinatorial mathematics, a block design is an incidence structure consisting of a set together with a family of subsets known as ''blocks'', chosen such that number of occurrences of each element satisfies certain conditions making the co ...
, or edges of a
graph.
* A
design matrix in
analysis of variance
Analysis of variance (ANOVA) is a family of statistical methods used to compare the Mean, means of two or more groups by analyzing variance. Specifically, ANOVA compares the amount of variation ''between'' the group means to the amount of variati ...
is a (0, 1)-matrix with constant row sums.
* A logical matrix may represent an
adjacency matrix
In graph theory and computer science, an adjacency matrix is a square matrix used to represent a finite graph (discrete mathematics), graph. The elements of the matrix (mathematics), matrix indicate whether pairs of Vertex (graph theory), vertices ...
in
graph theory
In mathematics and computer science, graph theory is the study of ''graph (discrete mathematics), graphs'', which are mathematical structures used to model pairwise relations between objects. A graph in this context is made up of ''Vertex (graph ...
: non-
symmetric matrices correspond to
directed graphs, symmetric matrices to ordinary
graphs, and a 1 on the diagonal corresponds to a
loop at the corresponding vertex.
* The
biadjacency matrix of a simple, undirected
bipartite graph
In the mathematics, mathematical field of graph theory, a bipartite graph (or bigraph) is a Graph (discrete mathematics), graph whose vertex (graph theory), vertices can be divided into two disjoint sets, disjoint and Independent set (graph theo ...
is a (0, 1)-matrix, and any (0, 1)-matrix arises in this way.
* The
prime factor
A prime number (or a prime) is a natural number greater than 1 that is not a product of two smaller natural numbers. A natural number greater than 1 that is not prime is called a composite number. For example, 5 is prime because the only ways ...
s of a list of ''m''
square-free {{no footnotes, date=December 2015
In mathematics, a square-free element is an element ''r'' of a unique factorization domain ''R'' that is not divisible by a non-trivial square. This means that every ''s'' such that s^2\mid r is a unit of ''R''.
...
,
''n''-smooth numbers can be described as an ''m'' × π(''n'') (0, 1)-matrix, where π is the
prime-counting function, and ''a''
''ij'' is 1 if and only if the ''j''th prime divides the ''i''th number. This representation is useful in the
quadratic sieve factoring algorithm.
* A
bitmap image containing
pixel
In digital imaging, a pixel (abbreviated px), pel, or picture element is the smallest addressable element in a Raster graphics, raster image, or the smallest addressable element in a dot matrix display device. In most digital display devices, p ...
s in only two colors can be represented as a (0, 1)-matrix in which the zeros represent pixels of one color and the ones represent pixels of the other color.
* A binary matrix can be used to check the game rules in the game of
Go.
* The
four valued logic of two bits, transformed by 2x2 logical matrices, forms a
transition system
In theoretical computer science, a transition system is a concept used in the study of computation. It is used to describe the potential behavior of discrete systems. It consists of states and transitions between states, which may be labeled wi ...
.
* A
recurrence plot and its variants are matrices that shows which pairs of points are closer than a certain vicinity threshold in a
phase space
The phase space of a physical system is the set of all possible physical states of the system when described by a given parameterization. Each possible state corresponds uniquely to a point in the phase space. For mechanical systems, the p ...
.
Some properties

The matrix representation of the
equality relation
In mathematics, equality is a relationship between two quantities or expressions, stating that they have the same value, or represent the same mathematical object. Equality between and is written , and read " equals ". In this equality, ...
on a finite set is the
identity matrix
In linear algebra, the identity matrix of size n is the n\times n square matrix with ones on the main diagonal and zeros elsewhere. It has unique properties, for example when the identity matrix represents a geometric transformation, the obje ...
''I'', that is, the matrix whose entries on the diagonal are all 1, while the others are all 0. More generally, if relation ''R'' satisfies then ''R'' is a
reflexive relation
In mathematics, a binary relation R on a set X is reflexive if it relates every element of X to itself.
An example of a reflexive relation is the relation " is equal to" on the set of real numbers, since every real number is equal to itself. A ...
.
If the Boolean domain is viewed as a
semiring
In abstract algebra, a semiring is an algebraic structure. Semirings are a generalization of rings, dropping the requirement that each element must have an additive inverse. At the same time, semirings are a generalization of bounded distribu ...
, where addition corresponds to
logical OR
In logic, disjunction (also known as logical disjunction, logical or, logical addition, or inclusive disjunction) is a logical connective typically notated as \lor and read aloud as "or". For instance, the English language, English language ...
and multiplication to
logical AND
In logic, mathematics and linguistics, ''and'' (\wedge) is the truth-functional operator of conjunction or logical conjunction. The logical connective of this operator is typically represented as \wedge or \& or K (prefix) or \times or \cdo ...
, the matrix representation of the
composition of two relations is equal to the
matrix product of the matrix representations of these relations.
This product can be computed in
expected time O(''n''
2).
Frequently, operations on binary matrices are defined in terms of
modular arithmetic
In mathematics, modular arithmetic is a system of arithmetic operations for integers, other than the usual ones from elementary arithmetic, where numbers "wrap around" when reaching a certain value, called the modulus. The modern approach to mo ...
mod 2—that is, the elements are treated as elements of the
Galois field . They arise in a variety of representations and have a number of more restricted special forms. They are applied e.g. in
XOR-satisfiability.
The number of distinct ''m''-by-''n'' binary matrices is equal to 2
''mn'', and is thus finite.
Lattice
Let ''n'' and ''m'' be given and let ''U'' denote the set of all logical ''m'' × ''n'' matrices. Then ''U'' has a
partial order
In mathematics, especially order theory, a partial order on a set is an arrangement such that, for certain pairs of elements, one precedes the other. The word ''partial'' is used to indicate that not every pair of elements needs to be comparable ...
given by
:
In fact, ''U'' forms a
Boolean algebra
In mathematics and mathematical logic, Boolean algebra is a branch of algebra. It differs from elementary algebra in two ways. First, the values of the variable (mathematics), variables are the truth values ''true'' and ''false'', usually denot ...
with the operations
and &
or between two matrices applied component-wise. The complement of a logical matrix is obtained by swapping all zeros and ones for their opposite.
Every logical matrix has a transpose Suppose ''A'' is a logical matrix with no columns or rows identically zero. Then the matrix product, using Boolean arithmetic,
contains the ''m'' × ''m''
identity matrix
In linear algebra, the identity matrix of size n is the n\times n square matrix with ones on the main diagonal and zeros elsewhere. It has unique properties, for example when the identity matrix represents a geometric transformation, the obje ...
, and the product
contains the ''n'' × ''n'' identity.
As a mathematical structure, the Boolean algebra ''U'' forms a
lattice ordered by
inclusion; additionally it is a multiplicative lattice due to matrix multiplication.
Every logical matrix in ''U'' corresponds to a binary relation. These listed operations on ''U'', and ordering, correspond to a
calculus of relations, where the matrix multiplication represents
composition of relations
In the mathematics of binary relations, the composition of relations is the forming of a new binary relation from two given binary relations ''R'' and ''S''. In the calculus of relations, the composition of relations is called relative multiplica ...
.
Logical vectors
If ''m'' or ''n'' equals one, then the ''m'' × ''n'' logical matrix (''m''
''ij'') is a logical vector or
bit string. If ''m'' = 1, the vector is a row vector, and if ''n'' = 1, it is a column vector. In either case the index equaling 1 is dropped from denotation of the vector.
Suppose
and
are two logical vectors. The
outer product
In linear algebra, the outer product of two coordinate vectors is the matrix whose entries are all products of an element in the first vector with an element in the second vector. If the two coordinate vectors have dimensions ''n'' and ''m'', the ...
of ''P'' and ''Q'' results in an ''m'' × ''n''
rectangular relation
:
A reordering of the rows and columns of such a matrix can assemble all the ones into a rectangular part of the matrix.
Let ''h'' be the vector of all ones. Then if ''v'' is an arbitrary logical vector, the relation ''R'' = ''v h''
T has constant rows determined by ''v''. In the
calculus of relations such an ''R'' is called a vector.
[ A particular instance is the universal relation .
For a given relation ''R'', a maximal rectangular relation contained in ''R'' is called a concept in ''R''. Relations may be studied by decomposing into concepts, and then noting the induced concept lattice.
Consider the table of group-like structures, where "unneeded" can be denoted 0, and "required" denoted by 1, forming a logical matrix To calculate elements of , it is necessary to use the logical inner product of pairs of logical vectors in rows of this matrix. If this inner product is 0, then the rows are orthogonal. In fact, ]small category
In mathematics, a category (sometimes called an abstract category to distinguish it from a concrete category) is a collection of "objects" that are linked by "arrows". A category has two basic properties: the ability to compose the arrows asso ...
is orthogonal to quasigroup
In mathematics, especially in abstract algebra, a quasigroup is an algebraic structure that resembles a group in the sense that " division" is always possible. Quasigroups differ from groups mainly in that the associative and identity element pro ...
, and groupoid
In mathematics, especially in category theory and homotopy theory, a groupoid (less often Brandt groupoid or virtual group) generalises the notion of group in several equivalent ways. A groupoid can be seen as a:
* '' Group'' with a partial fu ...
is orthogonal to magma
Magma () is the molten or semi-molten natural material from which all igneous rocks are formed. Magma (sometimes colloquially but incorrectly referred to as ''lava'') is found beneath the surface of the Earth, and evidence of magmatism has also ...
. Consequently there are zeros in , and it fails to be a universal relation.
Row and column sums
Adding up all the ones in a logical matrix may be accomplished in two ways: first summing the rows or first summing the columns. When the row sums are added, the sum is the same as when the column sums are added. In incidence geometry, the matrix is interpreted as an incidence matrix with the rows corresponding to "points" and the columns as "blocks" (generalizing lines made of points). A row sum is called its ''point degree'', and a column sum is the ''block degree''. The sum of point degrees equals the sum of block degrees.[E.g., see ]
An early problem in the area was "to find necessary and sufficient conditions for the existence of an incidence structure
In mathematics, an incidence structure is an abstract system consisting of two types of objects and a single relationship between these types of objects. Consider the Point (geometry), points and Line (geometry), lines of the Euclidean plane as t ...
with given point degrees and block degrees; or in matrix language, for the existence of a (0, 1)-matrix of type ''v'' × ''b'' with given row and column sums".[ This problem is solved by the Gale–Ryser theorem.
]
See also
* List of matrices
* Binatorix (a binary De Bruijn torus)
* Bit array
A bit array (also known as bitmask, bit map, bit set, bit string, or bit vector) is an array data structure that compactly stores bits. It can be used to implement a simple set data structure. A bit array is effective at exploiting bit-level par ...
* Disjunct matrix
* Redheffer matrix
* Truth table
A truth table is a mathematical table used in logic—specifically in connection with Boolean algebra, Boolean functions, and propositional calculus—which sets out the functional values of logical expressions on each of their functional arg ...
* Three-valued logic
Notes
References
*
*
*
*
*
*
*
*
*
*
External links
*
{{DEFAULTSORT:Logical Matrix
Boolean algebra
Matrices (mathematics)