Let $V\_0, V\_1, \dots, V\_n$ denote a series of finite-dimensional vector spaces. We write $v\_i : = \dim V\_i$ for $i=0, 1, \dots, n$. I am thinking of these as real vector spaces, but I think the answer to my question ultimately doesn't depend on that.


Consider the affine space $A^N := \oplus\_{i=0}^{n-1} \mbox{Hom}(V\_{i+1},V\_i)$. In $A^N$, consider the variety $W$ of $n$-tuples of linear maps $(\phi\_1, \phi\_2, \dots, \phi\_n)$ such that $\phi\_i \circ \phi\_{i+1} =0$ for every $1 \le i \le n-1$. Here, every point in $W$ represents a chain complex on the given vector spaces.


**What is $\dim W$, as a function of $v\_0, v\_1, \dots, v\_n$?**


Here is what I know so far. For every $n$-tuple of non-negative integers $(r\_1, r\_2, \dots, r\_n)$, we can consider $W(r\_1, r\_2, \dots, r\_n)$ defined to be the subvariety where $\mbox{rank} \, \phi\_i = r\_i$ for every $1 \le i \le n$. It is not hard to see that this subvariety is nonempty if and only if $r\_i + r\_{i+1} \le v\_i$ for $i=0, 1, \dots$, so we will make this assumption going forward. (We make the convention that $r\_0 =r\_{n+1} = 0$.)


There are formulas for the dimensions of these subvarieties. In particular,
$$ \dim W(r\_1, r\_2, \dots, r\_n) = \sum\_{i=0}^n (v\_i-r\_{i+1})(r\_i+r\_{i+1}).$$
This can be found, for example, as Lemma 2.3 in the paper ["On the Variety of Complexes", by De Concini and Strickland, which appeared in Advances in Mathematics in 1981](https://www.sciencedirect.com/science/article/pii/S0001870881800047). They say that this is a well-known result, and they are including a proof for the sake of completeness. (Comment: they actual consider the subvarieties where $\mbox{rank} \, \phi\_i \le r\_i$, but these have the same dimension, so the above formula still holds.)


So one way to answer my question is that
$$ \dim W = \max \{ \dim W(r\_1, \dots, r\_n)\},$$
as $(r\_1, \dots, r\_n)$ ranges over all possible values. However, this is a little bit unsatisfying. It reduces the question to a quadratic optimization problem, over integer points in the convex polytope cut out by the linear inequalities:


1. $0 \le r\_i$ for every $i$
2. $r\_i + r\_{i+1} \le v\_i$


We observe that $\dim W(r\_1, r\_2, \dots, r\_n)$ is strictly increasing in each $r\_i$. However, this observation does not solve the optimization problem by itself. In fact, there may be many subvarieties that have equal, maximum dimension.
For example, if $(v\_0, v\_1, \dots, v\_6) = (10,10,10,10,10,10,10)$, then the ranks that maximize dimension are $(7,3,4,6,2,8)$, $(7,3,5,5,2,8)$, $(7,3,5,5,3,7)$, $(8,2,5,5,2,8)$, $(8,2,5,5,3,7)$, and $(8,2,6,4,3,7)$.


In special cases, I can solve this exactly. For example, it seems more tractable when the dimensions of the vector spaces are all equal $v\_0 = v\_1 = \dots = v\_n$, although even then the cases of $n$ even and $n$ odd seem to work out quite differently.


I am curious if there are some things that make $\dim W$ more amenable to computation than this, in the general setting. Is there either something that greatly simplifies the quadratic optimization problem, or another way entirely to compute $\dim W$?


De Concini and Stickland mention at the beginning of their paper that the varieties $W$ and $W(r\_1, \dots, r\_n)$ are called Buchsbaum–Eisenbud varieties of complexes.



What is the dimension of the variety of chain complexes?
There is a general special case where the problem has a nice answer. The situation is when the dimensions of the vector spaces are equal in pairs, or in other words $\dim V\_{2i}=\dim V\_{2i+1}$ for $0\le i\le \lfloor (n-1)/2 \rfloor$.


For convenience, we keep the auxiliary $r\_{0}=r\_{n+1}=0$, and in the case of even $n$, we also add $r\_{n+2}=v\_{n}$ and $v\_{n+1}=v\_n$. One can regroup the terms in the formula for $\dim W(r\_1, r\_2, \dots, r\_n)$ as follows:
$$\dim W(r\_1, r\_2, \dots, r\_n) = \sum\_{i=0}^n (v\_i-r\_{i+1})(r\_i+r\_{i+1})$$
$$=\sum\_{i=0}^{\lfloor n/2\rfloor} v\_{2i} v\_{2i+1}-
\frac12\sum\_{i=0}^{\lfloor n/2\rfloor}(r\_{2i}-r\_{2i+2})^2-\sum\_{i=0}^{\lfloor n/2 \rfloor}(v\_{2i+1}-r\_{2i}-r\_{2i+1})(v\_{2i}-r\_{2i+1}-r\_{2i+2})
+\frac{1}{2}r\_{2\lfloor\frac{n}{2}\rfloor+2}^2.$$
However, in our special case, the third summation is equal to $$\sum\_{i=0}^{\lfloor n/2 \rfloor}(v\_{2i+1}-r\_{2i}-r\_{2i+1})(v\_{2i}-r\_{2i+1}-r\_{2i+2})=\sum\_{i=0}^{\lfloor n/2 \rfloor}(v\_{2i}-r\_{2i}-r\_{2i+1})(v\_{2i+1}-r\_{2i+1}-r\_{2i+2}),$$
and we know that this must vanish at a maximum of $\dim W(r\_1, r\_2, \dots, r\_n)$, by the observation that our dimension is monotonic in each $r$, and thus, for each $i$, either $r\_{2i}+r\_{2i+1}\le v\_{2i}$ or $r\_{2i+1}+r\_{2i+2}\le v\_{2i+1}$ turns into an equality (otherwise you could increase $r\_{2i+1}$ by a small amount).


Hence, our problem reduces to minimizing the expression
$$\sum\_{i=0}^{\lfloor n/2\rfloor}(r\_{2i}-r\_{2i+2})^2 \tag{\*}$$
subject to our restrictions. This can be done by applying Cauchy-Schwarz, which tells us that the differences $r\_{2i}-r\_{2i+2}$ would have to be as close as possible to each other.


When $n$ is odd, the maximum can be achieved by taking $r\_0=r\_2=\cdots=r\_{n+1}=0$, and the remaining values will be $r\_{2i+1}=v\_{2i}=v\_{2i+1}$ for $0\le i\le \frac{n-1}{2}$.


When $n$ is even we have $r\_0=0$ and $r\_{n+2}=v\_n$. We can visualize our restriction as saying that the data points $(i, r\_{2i})$ must lie below the points $(i,\min(v\_{2i}, v\_{2i-1}))$ for $1\le i\le \frac{n}{2}$ together with endpoints $(0,0)$ and $(\frac{n}{2}+1,v\_n)$. Applying Cauchy-Schwarz in intervals shows that the (real) maximum is achieved when the points $(i,r\_{2i})$ are on the Newton polygon (convex hull) of the points $(i,\min(v\_{2i}, v\_{2i-1}))$, and the integral maximum is obtained by taking $r\_{2i+2}-r\_{2i}$ to be as close as possible to the slope of the corresponding edge of the Newton polygon.


There will be choices of taking either the ceiling or the floor of the slope, but we must make sure the final sum of all assigned values to the $r\_{2i+2}-r\_{2i}$'s comes out to $v\_n$. In the example of $(v\_0,v\_1,\dots,v\_6)=(10,10,\dots,10)$, we want $r\_{2i+2}-r\_{2i}$ to be as close as possible to the slope $10/4=2.5$ so we can choose either $2$ or $3$, since the final sum is $10$ the choices have to be some ordering of $2,2,3,3$, and each of the $6$ orderings corresponds to one of the maxima you listed.


