Is it possible to find the derivative of components of a real antisymmetric matrix using index notation? Eg: I have a very large real antisymmetric matrix. Then from Matrix Cookbook, we know the formula that: $$\frac{dx_{k\ell}}{dx_{\beta\alpha}}=\delta_{k\beta}\delta_{l\alpha}-\delta_{k\alpha}\delta_{l\beta}$$ This formula is a general one and can be applied to any indices. So is there a way to define this in Mathematica for any general indices? That means even if I use, $$\frac{dx_{ab}}{dx_{cd}}$$,it should return the answer without any other definition. Is this possible? Please help as I am new to Mathematica. Some other equations that can be obtained from the above relation of differentiation real antisymmetric matrices are given as: $$\frac{d}{dx_{\beta\alpha}}\left(x_{\upsilon l}x_{k\mu}\right)=\left(\delta_{\upsilon\beta}\delta_{l\alpha}-\delta_{\upsilon\alpha}\delta_{l\beta}\right)x_{k\mu}+x_{\upsilon l}\left(\delta_{k\beta}\delta_{\mu\alpha}-\delta_{k\alpha}\delta_{\mu\beta}\right)$$ $$\frac{d}{dx_{\beta\alpha}}\left(x_{k\alpha}x_{\beta l}\right)=-2\left(D-1\right)x_{lk}=2\left(D-1\right)x_{kl}$$ $$\frac{d}{dx_{\beta\alpha}}x_{j\alpha}=\delta_{j\beta}\delta_{\alpha\alpha}-\delta_{j\alpha}\delta_{\alpha\beta}=\left(D-1\right)\delta_{j\beta}$$ But my issue is that this is not the only indices I need to use. I need to find out the same with other indices. So is there is a way that Mathematica can find it automatically. Also in the below expression, I have implemented the product rule. $$\frac{d}{dx_{\beta\alpha}}\left(x_{\upsilon l}x_{k\mu}\right)=\left(\delta_{\upsilon\beta}\delta_{l\alpha}-\delta_{\upsilon\alpha}\delta_{l\beta}\right)x_{k\mu}+x_{\upsilon l}\left(\delta_{k\beta}\delta_{\mu\alpha}-\delta_{k\alpha}\delta_{\mu\beta}\right)$$ So if these things can be calculated by Mathematica, then I can check my calculations. D is the dimension of the real antisymmetric matrices. $$ \sum_{ijkl}f_{ijkl}=-\sum_{ijkl}f_{jikl} $$ The above tensor f is defined in such a way that we can exchange it's indices such a way that one exchange of neighboring indices results in a negative sign. Two nearby exchanges result in no change in sign. $$ \sum_{ijkl}f_{ijkl}x_{k\alpha}^{-}\frac{dx_{ij}^{+}}{dx_{\beta\alpha}}x_{\beta\ell}^{+} $$ $$= \sum_{ijkl}f_{ijkl}x_{k\alpha}^{-}\left(\delta_{i\beta}\delta_{j\alpha}-\delta_{i\alpha}\delta_{j\beta}\right)x_{\beta\ell}^{+}$$ $$=\sum_{ijkl}f_{ijkl} x_{k\alpha}^{-}x_{\beta\ell}^{+}\delta_{i\beta}\delta_{j\alpha}-\sum_{ijkl}f_{ijkl}x_{k\alpha}^{-}x_{\beta\ell}^{+}\delta_{i\alpha}\delta_{j\beta}$$ $$=\sum_{ijkl}f_{ijkl} x_{kj}^{-}x_{i\ell}^{+}-\sum_{ijkl}f_{ijkl}x_{ki}^{-}x_{j\ell}^{+}$$ $$= \sum_{ijkl}f_{ijkl}x_{kj}^{-}x_{i\ell}^{+}-\sum_{jikl}f_{jikl}x_{kj}^{-}x_{i\ell}^{+}$$ $$= \sum_{ijkl}f_{ijkl}x_{kj}^{-}x_{i\ell}^{+}+\sum_{ijkl}f_{jikl}x_{kj}^{-}x_{i\ell}^{+}$$ $$= 2\sum_{ijkl}f_{ijkl}x_{kj}^{-}x_{i\ell}^{+} $$ Utilizing the antisymmetric property of x matrices we can rewrite the above expression as: $$ \sum_{ijkl}f_{ijkl}x_{k\alpha}^{-}\frac{dx_{ij}^{+}}{dx_{\beta\alpha}}x_{\beta\ell}^{+}=-2\sum_{ijkl}f_{ijkl}x_{jk}^{+}x_{i\ell}^{+} $$ We have $$ x_{kj}^{-}=x_{kj}-i\delta_{kj}=-x_{jk}-i\delta_{kj}=-x_{jk}^{+} $$ When I try to evaluate the following code:

myD[x[v, l] - x[β, α], x[p, u]]

with the following before,

myD[a_ - b_, c_] := myD[a, c] - myD[b, c]
myD[a_ + b_, c_] := myD[a, c] + myD[b, c]

It's returning zero.


  • $\begingroup$ Do you mean something like this?: mathematica.stackexchange.com/a/216806/1871 $\endgroup$ – xzczd Jul 17 '20 at 6:48
  • $\begingroup$ Hi @xzczd, I have read that. Great work and thanks for your comment. But I am new to Mathematica and I am not sure how to convert it to my case. What I need is to calculate mathematical calculations involving Einstein summation symbolically in Mathematica. $\endgroup$ – Jasmine Jul 19 '20 at 5:15
  • $\begingroup$ Er… Do you mean things like $\delta_{k\beta}$ should not evaluate to a explicit list Table[KroneckerDelta[x, y], {x, 3}, {y, 3}]? $\endgroup$ – xzczd Jul 19 '20 at 5:42
  • 1
    $\begingroup$ Those deltas are normal Kronecker deltas. But in my case as you expressed we can't express it as a matrix. I am doing all calculations using Einstein notations. Also mine is not a 3 X 3 matrix. It is a very large matrix, maybe 500 X 500 ! So only possibility is using index $\endgroup$ – Jasmine Jul 19 '20 at 5:46
  • $\begingroup$ The question is still a bit unclear to me. Seems that you're working with explicit lists, then I think my allowtensor can be used. Just adjust $tensordimension to $tensordimension = 500. If you still have difficulty in coding, please show us a more specific example. $\endgroup$ – xzczd Jul 19 '20 at 5:51

After a second thought I notice it's not that hard to implement:

ClearAll[myD, δ]

myD[x_[k_, l_], x_[β_, α_]] := δ[k, β] δ[l, α] - δ[k, α] δ[l, β]
myD[a_ b_, c_] := a myD[b, c] + b myD[a, c]

SetAttributes[δ, Orderless]
δ /: δ[a_, b_] h_[former___, b_, latter___] := h[former, a, latter]
δ[a_, a_] = \[FormalCapitalD];

The following rule isn't necessary but will make the output pretty:

Format[δ[a_, b_]] := Subscript[δ, a, b]
Format[x[a_, b_]] := Subscript[x, a, b]


myD[x[a, b], x[c, d]]

enter image description here

myD[x[v, l] x[k, μ], x[β, α]]

enter image description here

myD[x[k, α] x[β, l], x[β, α]] // Simplify

enter image description here

myD[x[j, α], x[β, α]]

enter image description here

myD[x[v, l] x[k, μ], x[β, α]]

enter image description here

The property of antisymmetric matrix isn't used in the calculation above so I don't implement it, but it should be easy to add if needed.

As to the new example, just define the following rule for f:

f[arg__] /; ! OrderedQ@{arg} := Signature@{arg} f @@ Sort@{arg}

Then the index of f will be sorted in lexicographical order (dictionary order).

Again, the following is not necessary, but will make the output pretty:

Format[f[arg__]] := Subscript[f, arg]


f[j, i, k, l]

enter image description here

f[i, j, k, l] x[k, α] myD[x[i, j], x[β, α]] x[β, l] // Simplify

enter image description here

% /. {α -> j, β -> i}

enter image description here

Still, the antisymmetric property of x doesn't play a role here so I don't implement it, but you can add the property in the same manner as defining f.

  • $\begingroup$ You are an amazingly talented guy. This is exactly what I want. Thank you so much. $\endgroup$ – Jasmine Jul 19 '20 at 7:21
  • $\begingroup$ Is it possible to add the property of the real antisymmetric matrices? That would be really helpful. $\endgroup$ – Jasmine Jul 19 '20 at 7:22
  • $\begingroup$ @Jasmine Can you show me an example in which the antisymmetric property plays a role? $\endgroup$ – xzczd Jul 19 '20 at 7:29
  • $\begingroup$ Hi xzczd, I have edited the question again. Can you please see the details $\endgroup$ – Jasmine Jul 19 '20 at 8:01
  • 1
    $\begingroup$ But it's not working. I have edited my original. Can you please see the last part? $\endgroup$ – Jasmine Jul 19 '20 at 21:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.