Matrix algebra needed to derive tricky equation... Trophic levels and networks! Imagine a food web (a directed, acyclic network) where the nodes are species and the edges represent predator-prey relationships. Prey nodes have an edge directed to the predators that eat them. Plants are on the bottom, connected to herbivores, then those are connected to carnivores etc. 
They are ranked on different trophic levels; e.g. plants might be $1$, herbivores $2$ and carnivores might be $3$. One possible definition of the trophic level $x_{i}$ of a species/node in a (directed) food web is the mean of the trophic levels of the species’ prey, plus one.

Here's the problem though! I need to:
$(a)$ Show that $x_i$, when defined [like I said above], is the $i$th element of the vector $\vec{x} = (D - A^{-1}D)\cdot \vec{1}$,
where $D$ is the diagonal matrix of in-degrees, $A$ is the (asymmetric) adjacency matrix, and $\vec{1} = (1, 1, 1, ...)$
$$D = \begin{pmatrix}
 k_{1, in} & 0 & 0  & 0\\ 
 0& k_{2, in} & 0 & 0\\ 
 0& 0 & ... & 0 \\ 
 0& 0 & 0 & k_{n, in}
\end{pmatrix}$$
For example if there were one predator (node $1$) that fed on two prey species (nodes $2$ and $3$), the adjacency matrix would look like: 
$$A = \begin{pmatrix}
0 &0  &0 \\ 
1 & 0 &0 \\ 
 1&0  &0 
\end{pmatrix},  
D = \begin{pmatrix}
2 &0  &0 \\ 
0 & 0 &0 \\ 
 0&0  &0 
\end{pmatrix}$$
$(b)$ This expression does not work for autotrophs—species with no prey—because the corresponding vector element diverges. Such species are usually given a trophic level of one. Suggest a modification of the calculation that will correctly assign trophic levels to these species, and hence to all species.

Okay, so I still need to go from $x_{i} = 1+\frac{1}{k_{i, in}}\cdot\sum_{j}^{n}A_{ij}\cdot x_{j}$ all the way to $\vec{x} = (D - A^{-1}D)\cdot \vec{1}$, but I'm not sure how. I'm inexperienced in matrix algebra by the way... 
I figure that $\frac{1}{k_{i, in}}$ is going to become $D^{-1}$, but that's about it. Perhaps $\sum_{j}^{n}A_{ij}\cdot x_{j}$ can be written as $A \cdot x$? I have absolutely ZERO clues to how part $(b)$ would work too. Thank you so much for any help you can offer! 
 A: As I mentioned in my comments, I don’t see how this can ever work as written. Your example adjacency matrix $A$ is obviously singular, so $A^{-1}$ doesn’t exist. Moreover, the adjacency matrix of any DAG is nilpotent, which in particular means that it’s not invertible. We can see this general non-invertibility directly: since the graph is acyclic, there must be some “top” predator species—one that nothing preys on—which creates a zero row in $A$. As well, there must be at least one autotroph, which creates a zero column. Either one of these causes the adjacency matrix to be singular.  
We can nevertheless derive an expression for $\vec x$ starting from the equation for $x_i$ that you wrote down (with a small, but important correction). From the definition of $x_i$ we have $$x_i = 1+\frac1{d_{ii}}\sum_{j=1}^n A_{ji}x_j. \tag1$$ Note that the term under the summation is $A_{ji}x_j$, not $A_{ij}x_j$ as you had it: you need to go down the column of $A$ corresponding to the current species, not across the row, in order to find all of its prey. This formulation runs into trouble immediately, though: $d_{ii}=0$ for autotrophs. We can try to finesse this by multiplying through by $d_{ii}$ to get $$d_{ii}x_i=d_{ii}+\sum_{j=1}^n A_{ji}x_j. \tag2$$ This doesn’t have any embarrassing divisions by zero, but the resulting system of equations is underdetermined. The equation for an autotroph is $0=0$, which contributes nothing. This makes some sense, though. The variables corresponding to autotrophs are free: we can assign arbitrary trophic levels to these “leaf” species and then propagate them upwards through the network.  
In any case, we can’t really get a nice closed-form expression for $\vec x$ without dealing with autotrophs somehow†. The suggestion in the problem is to assign them a level of $1$. There are a few ways to do this, but the simplest I think is to define $D$ such that the minimum value along the diagonal is $1$. The corresponding column of $A$ is still all zero, so the equation for an autotroph ends up being $x_i=1$, which is exactly what we want. With this patch, we can proceed. The system (1) can be expressed in matrix form as $$\vec x = \vec 1 + D^{-1}A^T\vec x$$ with solution $$\vec x = (I-D^{-1}A^T)^{-1} \vec 1,$$ assuming that the inverse exists. Alternatively, we can start with the matrix form of (2) to get $$\vec x= (D - A^T)^{-1}D \vec 1,$$ which looks a bit more like the expression in your question.  

† Well, not without introducing something more complex like the Moore-Penrose inverse, at any rate.
