# is there a tensor that does the following?

I want a tensor (in the multi-linear algebra sense) which takes as an input a matrix $A$ of size $n \times n$ and returns as output an $n \times n$ matrix which is diagonal (zero off-diagonal), and on each diagonal element $(i,i)$, the value is $\sum_{j} A_{ij}$.

Is there such a tensor (I am guessing it would be of dimensions $n \times n \times n \times n$)?

Thanks.

-

By hypothesis, we have

$$T_{ab}^{\,ij}A_{ij}=\delta_{ab}\sum_j A_{aj}=\delta_{ab}1^jA_{aj}=\delta_{ab}1^j\delta_{a}^iA_{ij},$$

where $1^j$ has component $1$ for each index $j$. So $T_{ab}^{\,ij}=\delta_{ab}^i1^j$ is the desired tensor.

-
thanks! Is $\delta_{ab} = 1$ if $a = b$ and $0$ otherwise? Is $\delta_{abi}=1$ only if $a=b=i$ and 0 otherwise? I am not sure I understand the notation $T^{ij}_{ab} = \delta_{abi}1^j$, but I am guessing it means that $T_{a,b,i,j}$ should equal something in coordinate $a,b,i,j$ where $a,b,i,j$ are between 1 and $n$. thanks again! – kloop May 17 '12 at 0:13
@kloop: Yes to your questions (also see Einstein notation). Writing $\delta_{ab}^i$ next to $1^j$ is the like forming the $n\times n$ matrix $xy^T$ out of the column vectors $x$ and $y$, just this time we're combining tensors. Ultimately, the $_{ab}^{ij}$ component of $T$ is $1$ precisely when $a=b=i$ and is $0$ otherwise (so $j$ is irrelevant - this is encoded by the $1^j$ because it is identity regardless of $j$). – anon May 17 '12 at 0:21

Let $k$ be our ground field, and let $\mathrm{M}_n\left(k\right)$ denote the algebra of $n\times n$ matrices over $k$.

Let $u:\mathrm{M}_n\left(k\right)\to \mathrm{M}_n\left(k\right)$ be the map you described, i. e., the map which takes any matrix $A\in \mathrm{M}_n\left(k\right)$ to the matrix

$\mathrm{diag}\left(\sum\limits_j A_{1,j}, \sum\limits_j A_{2,j}, ..., \sum\limits_j A_{n,j}\right) \in \mathrm{M}_n\left(k\right)$.

This map $u$ is $k$-linear, i. e., an element of $\mathrm{Hom}\left(\mathrm{M}_n\left(k\right),\mathrm{M}_n\left(k\right)\right)\cong \left(\mathrm{M}_n\left(k\right)\right) \otimes \left(\mathrm{M}_n\left(k\right)\right)^{\ast}$. Since $\mathrm{M}_n\left(k\right)\cong k^n \otimes k^{n\ast}$, this map thus can be viewed as an element of $\left(k^n \otimes k^{n\ast}\right) \otimes \left(k^n \otimes k^{n\ast}\right) ^{\ast} \cong k^n \otimes k^{n\ast} \otimes k^{n\ast} \otimes k^n$. So yes, it is a tensor.

What tensor? I wish I could answer this in a nice and simple basis-free way, but I don't think there is such a way (note that even the trace tensor, which lies in $k^n \otimes k^{n\ast}$, is not easily described without a basis - which is not surprising given that it only exists in the finite-dimensional setup). Here is how to do it with a basis: For any $i$ and $j$, let $E_{i,j}$ be the $n\times n$ matrix over $k$ whose $\left(i,j\right)$-th entry is $1$ and whose all other entries are $0$. Then, $\left(E_{i,j}\right)_{1\leq i\leq n,\ 1\leq j\leq n}$ is a basis of the $k$-vector space $\mathrm{M}_n\left(k\right)$. Let $\left(E_{i,j}^{\ast}\right)_{1\leq i\leq n,\ 1\leq j\leq n}$ be its dual basis of the $k$-vector space $\mathrm{M}_n\left(k\right)^{\ast}$. Then,

$u\left(A\right) = \mathrm{diag}\left(\sum\limits_j A_{1,j}, \sum\limits_j A_{2,j}, ..., \sum\limits_j A_{n,j}\right) = \sum\limits_i\sum\limits_j \underbrace{A_{i,j}}_{=E_{i,j}^{\ast}\left(A\right)} E_{i,i} = \sum\limits_i\sum\limits_j E_{i,j}^{\ast}\left(A\right) E_{i,i}$

for any matrix $A$. Thus, the map $u$ corresponds to the element $\sum\limits_i\sum\limits_j E_{i,i} \otimes E_{i,j}^{\ast}$ of $\left(\mathrm{M}_n\left(k\right)\right) \otimes \left(\mathrm{M}_n\left(k\right)\right)^{\ast}$.

Now let $\left(e_1,e_2,...,e_n\right)$ be the standard basis of $k^n$, and $\left(e_1^{\ast},e_2^{\ast},...,e_n^{\ast}\right)$ be its dual basis of $k^{n\ast}$. Since the identification of $\mathrm{M}_n\left(k\right)$ with $k^n \otimes k^{n\ast}$ equates $E_{p,q}$ with $e_p \otimes e_q^{\ast}$ for all $p$ and $q$, the element $\sum\limits_i\sum\limits_j E_{i,i} \otimes E_{i,j}^{\ast}$ of $\left(\mathrm{M}_n\left(k\right)\right) \otimes \left(\mathrm{M}_n\left(k\right)\right)^{\ast}$ can be seen as the element $\sum\limits_i\sum\limits_j e_i \otimes e_i^{\ast} \otimes e_i^{\ast} \otimes e_j$ of $k^n \otimes k^{n\ast} \otimes k^{n\ast} \otimes k^n$. So this is the tensor representing $u$.

-