# Matroid rank

In the mathematical theory of matroids, the rank of a matroid is the maximum size of an independent set in the matroid. The rank of a subset S of elements of the matroid is, similarly, the maximum size of an independent subset of S, and the rank function of the matroid maps sets of elements to their ranks.
The rank function is one of the fundamental concepts of matroid theory via which matroids may be axiomatized. Matroid rank functions form an important subclass of the submodular set functions. The rank functions of matroids defined from certain other types of mathematical object such as undirected graphs, matrices, and field extensions are important within the study of those objects.

## Examples

In all examples, E is the base set of the matroid, and B is some subset of E.
* Let M be the free matroid, where the independent sets are all subsets of E. Then the rank function of M is simply: r(B) = |B|.
* Let M be a uniform matroid, where the independent sets are the subsets of E with at most k elements, for some integer k. Then the rank function of M is: r(B) = min(k, |B|).
* Let M be a partition matroid: the elements of E are partitioned into categories, each category c has capacity k$_c$, and the independent sets are those containing at most k$_c$ elements of category c. Then the rank function of M is: r(B) = sum$_c$ min(k$_c$, |B$_c$|) where B$_c$ is the subset B contained in category c.
* Let M be a graphic matroid, where the independent sets are all the acyclic edge-sets (forests) of some fixed undirected graph G. Then the rank function r(B) is the number of vertices in the graph, minus the number of connected components of B (including single-vertex components).

## Properties and axiomatization

The rank function of a matroid obeys the following properties.
(R1) The value of the rank function is always a non-negative integer and the rank of the empty set is 0.
(R2) For any two subsets $A$ and $B$ of $E$, $r(A\cup B)+r(A\cap B)\leq r(A)+r(B)$. That is, the rank is a submodular set function.
(R3) For any set $A$ and element $x$, $r(A)\leq r(A\cup \{x\})\leq r(A)+1$.
These properties may be used as axioms to characterize the rank function of matroids: every integer-valued submodular set function on the subsets of a finite set that obeys the inequalities $r(A)\leq r(A\cup \{x\})\leq r(A)+1$ for all $A$ and $x$ is the rank function of a matroid.
The above properties imply additional properties:
* If $A\subset B\subset E$, then $r(A)\leq r(B)\leq r(E)$. That is, the rank is a monotonic function.
* $r(A)\leq |A|$.

## Other matroid properties from rank

The rank function may be used to determine the other important properties of a matroid:
* A set is independent if and only if its rank equals its cardinality, and dependent if and only if it has greater cardinality than rank.
* A nonempty set is a circuit if its cardinality equals one plus its rank and every subset formed by removing one element from the set has equal rank.
* A set is a basis if its rank equals both its cardinality and the rank of the matroid.
* A set is closed if it is maximal for its rank, in the sense that there does not exist another element that can be added to it while maintaining the same rank.
* The difference $|A|-r(A)$ is called the nullity of the subset $A$. It is the minimum number of elements that must be removed from $A$ to obtain an independent set.
* The corank of a subset $A$ can refer to at least two different quantities: some authors use it to refer to the rank of $A$ in the dual matroid, $r^{*}(A)=|A|+r(E\setminus A)-r(E)$, while other authors use corank to refer to the difference $r(E)-r(A)$.

## Ranks of special matroids

In graph theory, the circuit rank (or cyclomatic number) of a graph is the corank of the associated graphic matroid; it measures the minimum number of edges that must be removed from the graph to make the remaining edges form a forest. Several authors have studied the parameterized complexity of graph algorithms parameterized by this number.
In linear algebra, the rank of a linear matroid defined by linear independence from the columns of a matrix is the rank of the matrix, and it is also the dimension of the vector space spanned by the columns.
In abstract algebra, the rank of a matroid defined from sets of elements in a field extension L/K by algebraic independence is known as the transcendence degree.

## Matroid rank functions as utility functions

Matroid rank functions (MRF) has been used to represent utility functions of agents in problems of fair item allocation. If the utility function of the agent is an MRF, it means that:
* The agent's utility has diminishing returns (this follows from the fact that the MRF is a submodular function);
* The agent's marginal utility for each item is dichotomous (binary) - either 0 or 1. That is, adding an item to a bundle either adds no utility, or adds a utility of 1.
The following solutions are known for this setting:
* Babaioff, Ezra and Feige design a deterministic polynomial-time truthful mechanism called Prioritized Egalitarian, that outputs a Lorenz dominating allocation, which is consequently also EFX$_0$, maximizes the product of utilities, attains 1/2-fraction maximin share, and attains the full maximin share when the valuations are additive. With random priorities, this mechanism is also ex-ante envy-free. They also study e-dichotomous valuations, in which the marginal utility is either non-positive or in the range [1,1+e].
* Benabbou, Chakraborty, Igarashi and Zick show that, in this setting, every Pareto-optimal allocation maximizes the sum of utilities (the utilitarian welfare), the set of allocations that maximize a symmetric strictly-concave function f over all max-sum allocations does not depend on the choice of f, and all these f-maximizing allocations are EF1. This implies that the max-product allocations are the leximin-optimal allocations, and they are all max-sum and EF1. They also present a polynomial-time algorithm that computes a max-sum and EF1 allocation (which does not necessarily maximize a concave function), and a polynomial-time algorithm that maximizes a concave function for the special case of MRFs based on maximum-cardinality matching in bipartite graphs.
The matroid-rank functions are a subclass of the gross substitute valuations.