Suppose we have a curvature-like tensor $R\in \wedge^2 T^\*\_p M \otimes T^\*\_p M \otimes T\_p M$ on a manifold $M$, that is $R(X,Y)Z = - R(Y,X)Z$. How does one determine whether or not this is a curvature tensor for some torsion-free affine connection?


One obvious condition is that the first Bianchi identity $R(X,Y)Z + R(Y,Z)X + R(Z,Y)X = 0$ must be satisfied. Are there other conditions that can be checked?



When is curvature given by a connection?
Yes, there are typically many further conditions. In dimension $n$, the space of curvature-like tensors that satisfy the first Bianchi identity are the sections of a bundle of rank $\tfrac13n^2(n^2{-}1)$, while the space of torsion-free connections is the space of sections of an affine bundle of rank $\tfrac12n^2(n{+}1)$, so, when $n>2$, the partial differential equation for the connection $\theta$ given the curvature-like tensor $\Omega$, i.e., $\mathrm{d}\theta + \theta\wedge\theta = \Omega$, is typically over-determined and has no solutions. [Added comment: For a discussion about why over-determined systems (such as this one when $n>2$) generally have no solution, see [Rigorous justification that overdetermined systems do not have a solution](https://mathoverflow.net/q/202506).] A trivial example of such an extra condition (when $n>2$) is that one must have $\mathrm{d}\bigl(\mathrm{tr}(\Omega)\bigr) = \mathrm{d}\bigl(\mathrm{tr}(\mathrm{d}\theta)\bigr) = 0$, but there are many more.


In fact, right away, one can see that the second Bianchi identity, i.e., $\mathrm{d}\Omega = \Omega\wedge\theta - \theta\wedge\Omega$ constitutes a number of inhomogeneous linear *algebraic* equations on $\theta$, and, when $n$ is sufficiently large ($n>3$ will do), these equations typically will have no solution, so such $\Omega$, even though they satisfy first Bianchi, cannot be the curvature of any connection, much less a torsion-free one.


**Addendum:** In my original answer, I wrote "*This problem has been well-studied in the intermediate cases when $n$ is not too large (so that there are some interesting PDE problems to discuss).*", but when the OP asked for references, I searched for a little while but couldn't find any that treated this particular problem. I am sure that I have seen this problem treated somewhere, but I couldn't turn anything up. Sorry about that. However, I can sketch the analysis via exterior differential systems, as it is straightforward. Perhaps this will be useful to the OP. Here is how it goes:


To understand the local solvability, suppose that a curvature-like tensor $R$ satisfying the first Bianchi identity has been specified on $M^n$. Choose a coframing $\eta = (\eta^i):TU\to \mathbb{R}^n$ on an open set $U\subset M$. (One could restrict to the case of a coordinate coframing, i.e., take $\eta^i = \mathrm{d}x^i$ for some local coordinate system $x = (x^i):U\to\mathbb{R}^n$, but the extra freedom of using a general coframing is sometimes useful.) Then $R$ will be represented by an $n$-by-$n$ matrix $\Omega = (\Omega^i\_j)$ of $2$-forms on $U$, say $\Omega^i\_j = \tfrac12 R^i\_{jkl}\,\eta^k\wedge\eta^l$, where $R^i\_{jkl}=-R^i\_{ilk}$. The condition that $R$ satisfy the first Bianchi identity is simply that $\Omega\wedge\eta = 0$,
i.e., that $R^i\_{jkl}+R^i\_{klj}+R^i\_{ljk}=0$. (Note that the $R^i\_{jkl}$ are $\tfrac13n^2(n^2{-}1)$ in number.) By Cartan's Lemma, the equations $\Omega\wedge\eta = 0$ imply that there exist $1$-forms $\rho^i\_{jk}=\rho^i\_{kj}$ on $U$ such that $\Omega^i\_j = \rho^i\_{jk}\wedge\eta^k$.


A torsion-free connection on $U$ will be represented, relative to the coframing $\eta$, by an $n$-by-$n$ matrix $\theta = (\theta^i\_j)$ of $1$-forms on $U$ that satisfies the *first structure equation* $\mathrm{d}\eta = -\theta\wedge\eta$. We want to know when it is possible to choose $\theta$ so that it satisfies the *second structure equation* $\mathrm{d}\theta + \theta\wedge\theta = \Omega$. 


Now, if $\mathrm{d}\eta^i = -\tfrac12 T^i\_{jk}\eta^j\wedge\eta^k$, then we must have
$$
\theta^i\_j = (T^i\_{jk} + p^i\_{jk})\eta^k
$$
for some (as yet unknown) functions $p^i\_{jk}=p^i\_{kj}$. (Note that the $p^i\_{jk}$ are $N=\tfrac12n^2(n{+}1)$ in number.) Let us regard the $p^i\_{jk}$ as fiber coordinates on the (trivial) bundle $V = U\times \mathbb{R}^N$ over $V$. We now work on $V$, where we have $\mathrm{d}\eta = -\theta\wedge\eta$. 


Differentiating the first structure equation yields that the matrix $\Theta = \mathrm{d}\theta + \theta \wedge\theta $ satisfies $\Theta\wedge\eta = 0$, so it follows (again, by Cartan's Lemma) that there exist 
$$
\pi^i\_{jk}=\pi^i\_{kj} = \mathrm{d}p^i\_{jk} + (\text{terms in $\eta$}).
$$
so that $\Theta^i\_j = \pi^i\_{jk}\wedge\eta^k$. 


Thus, we can write
$$
\Upsilon = \mathrm{d}\theta+\theta\wedge\theta - \Omega 
= \bigl((\pi^i\_{jk}-\rho^i\_{jk})\wedge\eta^k\bigr) 
= \bigl(\tilde\pi^i\_{jk}\wedge\eta^k\bigr),
$$
and we see that the *algebraic* ideal generated by the components of $\Upsilon$ is generated by the $2$-forms $\Upsilon^i\_j = \tilde\pi^i\_{jk}\wedge\eta^k$. A solution to our problem will be a section $u:U\to V = U\times \mathbb{R}^n$, that pulls back $\Upsilon$ to be zero.


Now, when $n=2$, the algebraic ideal suffices because we are only looking for a $2$-dimensional integral manifold, and the exterior derivative of $\Upsilon$ is a $3$-form, which will necessarily vanish when pulled back via *any* section $u$. Now, it is easy to see, from the above description that, in this case, the Cartan characters of the system are $(s\_1,s\_2) = (4,2)$ and the space of integral elements at each point has dimension $S = 8 = s\_1 + 2s\_2$, so the system is involutive, and local solutions exist and depend on $s\_2 = 2$ functions of $2$ variables (at least in the analytic case). (It is not hard to show that, in fact, local solutions always exist, even in the smooth case, when $n=2$, but let me skip over that discussion now. Basically, one can impose two conditions, such as $p^i\_{jj}=0$, and then the restricted system becomes elliptic.)


However, when $n>2$, the ideal generated by the components of $\Upsilon$ is not differentially closed. In fact, one has
$$
\mathrm{d}\Upsilon = \mathrm{d}(\Theta - \Omega) 
= \Theta\wedge\theta-\theta\wedge\Theta - \mathrm{d}\Omega
= (\Omega\wedge\theta-\theta\wedge\Omega - \mathrm{d}\Omega)
 + (\Upsilon\wedge\theta-\theta\wedge\Upsilon),
$$
so, to get a differentially closed ideal, one must add the components of the $3$-form $\Psi = (\Omega\wedge\theta-\theta\wedge\Omega - \mathrm{d}\Omega)$. Note that the $3$-form $\Psi$ does not involve any derivatives of $\theta$, and, in fact, is linear in the 'unknowns' $p^i\_{jk}$. In fact,
$$
\Psi^i\_j = \tfrac12\bigl(R^i\_{qkl}p^q\_{jm}-R^q\_{jkl}p^i\_{qm} - S^i\_{jklm}
\bigr)\,\eta^k\wedge\eta^l\wedge\eta^m
$$
for some functions $S^i\_{jklm}$ on $U$, so it follows that the graph of any solution to the problem must lie in the affine `subbundle' of $V = U\times\mathbb{R}^N$ defined by the vanishing of these coefficients. Most of the time, when $n>3$, this is more equations than unknowns $p^i\_{jk}$, and this locus will be empty. It is a nontrivial set of conditions on $R$ (and its derivative) that this locus be nonempty. (Of course, a (small) part of these conditions is that $\mathrm{d}\bigl(\mathrm{tr}(\Omega)\bigr) = 0$.) 


When $n=3$, things are a little more interesting. Typically, as long as $\mathrm{d}\bigl(\mathrm{tr}(\Omega)\bigr) = 0$ and the tensor $R$ is 'algebraically generic' in the appropriate sense, the equations above will define an affine bundle $W\subset V$ of rank $9$ over $U$, and generically, the Cartan characters will be $(s\_1,s\_2,s\_3) = (9,0,0)$. However, there will be nontrivial torsion, and the symbol will not be involutive, so you will get more obstructions at the next level. A detailed analysis is somewhat messy, but there are interesting special cases in which the curvature takes values in a simple subalgebra, such as ${\frak{so}}(3)$ or ${\frak{so}}(2,1)$. 


**Addendum 2:** The OP asked for 'conditions that can be checked', and the above discussion does not really address that question. I had one further thought about this in the dimensions above $n=3$ that I thought that OP might find useful, so here it is:


When $n\ge 4$, there is an algorithmic way to proceed that works in the 'generic' case. What I mean by 'generic' is this: Say that a curvature-like tensor $R$ that satisfies the first Bianchi identity is *algebraically generic* if the kernel of the mapping $L(\phi) = \Omega\wedge\phi - \phi\wedge\Omega$, from $1$-forms with values in $n$-by-$n$ matrices to $3$-forms with values in $n$-by-$n$ matrices, consists of the elements of the form $\phi = \alpha\,I\_n$, where $\alpha$ is a $1$-form (such elements are always in the kernel of $L$). It is not hard to show that, when $n\ge 4$, the generic curvature-like tensor $R$ that satisfies the first Bianchi identity is algebraically generic.


Suppose that one is given an algebraically generic $R$ and one wants to check whether it is the curvature of a torsion-free connection. Here are the steps:


1. Test whether $\mathrm{d}\Omega$ is in the image of $L$, i.e., whether there exists a *traceless* matrix with $1$-form entries $\phi$ such that $\mathrm{d}\Omega = L(\phi) = \Omega\wedge\phi-\phi\wedge\Omega$. Because of the algebraically generic hypothesis, if $\phi$ exists (which is a matter of linear algebra), it will be unique. If no such $\phi$ exists, then there is no solution.
2. Supposing that $\phi$ exists, consider the $2$-form $\mathrm{d}\eta + \phi\wedge\eta$. Either this can be written in the form $-\alpha\wedge\eta$ where $\alpha$ is a (scalar-valued) $1$-form, or it cannot. (When it can be written in this form, $\alpha$ is necessarily unique.) If it can, then $\theta = \phi + \alpha\,I\_n$ is a torsion-free connection form that satisfies $\mathrm{d}\Omega = \Omega\wedge\theta-\theta\wedge\Omega$ (and it is the only such torsion-free connection form). If it cannot, there is no solution.
3. Finally, check whether $\mathrm{d}\theta + \theta\wedge\theta = \Omega$. If this equation holds, then you have found the (unique) torsion-free connection that solves the problem. If this $\theta$ doesn't work, then there is no solution.


Thus, you can usually check whether your problem has a solution in dimensions greater than $3$. The only interesting cases that remain are those in dimension $3$ (where the problem can be subtle, since $L$ always has a large kernel) or algebraically special curvature-like tensors in higher dimensions.


