What else is needed to make Mathematica to simplify the following expression to $z[j]$?

enter image description here


 {n \[Element] Integers, p \[Element] Integers,
  i \[Element] Integers, j \[Element] Integers,
  r \[Element] Integers, s \[Element] Integers,
  n >= 1, p >= 1,
  i >= 1, i <= n,
  j >= 1, j <= p,
  r >= 1, r <= p,
  s >= 1, s <= n,
\*UnderoverscriptBox[\(\[Sum]\), \(r = 1\), \(p\)]\(z[r]*\(
\*UnderoverscriptBox[\(\[Sum]\), \(s = 1\), \(n\)]\*
TemplateBox[{RowBox[{"i", ",", "s"}]},
"KroneckerDeltaSeq"] \*
TemplateBox[{RowBox[{"j", ",", "r"}]},
  • $\begingroup$ 1) Use KroneckerDelta instead of "KroneckerDeltaSeq" (no idea what's that supposed to mean); 2) what is it that you really want to achieve? As shown, you're multiplying a sum of zs by a sum of $\delta$s - why should it even be equal to z[j]? $\endgroup$
    – corey979
    Jan 20, 2018 at 8:46
  • $\begingroup$ @corey979 1) "KroneckerDeltaSeq" is produced by copy and paste, replacing it with "KroneckerDelta" doesn't make a difference. 2) I want to simplify the expression to it's simplest form, which IS $z[j]$: The first delta in the second sum is not zero only when $s=i$, thus the second sum resolves to $\delta _{j,r}$, so the second sum is one only when $s=i, r=j$, which makes the entire expression $z[j]$ $\endgroup$ Jan 20, 2018 at 9:03
  • $\begingroup$ @corey979 oh, I think you misunderstood the expression, it's $\Sigma (z \Sigma \_)$, not $(\Sigma z)(\Sigma \_)$ $\endgroup$ Jan 20, 2018 at 9:08
  • $\begingroup$ So you want FullSimplify[ Sum[z[r]* Sum[KroneckerDelta[i, s]*KroneckerDelta[j, r], {s, 1, n}], {r, 1, p}]]. $\endgroup$
    – corey979
    Jan 20, 2018 at 9:29
  • $\begingroup$ Yes, but just using the above equation (FullSimplify...) wouldn't yield the desired result. $\endgroup$ Jan 20, 2018 at 12:27

1 Answer 1


Try this:

    KroneckerDelta[i, s] KroneckerDelta[j, r], {s, 1, n}], {r, 1, 
   p}], {{i, j, n, p, s, r} \[Element] Integers, n >= 1, p >= 1, 
  i >= 1, j >= 1, r >= 1, i <= n, j <= p, s <= n, r <= p}]

yielding the following:

enter image description here

Have fun!

  • $\begingroup$ The code in the question also produces this output, the problem is, it is not the simplest form. $\endgroup$ Jan 20, 2018 at 14:30
  • $\begingroup$ Here's an observation: DiscreteDelta[j - r] // PiecewiseExpand gives the bracketed expression in the answer above. Is there an inverse to PiecewiseExpand? $\endgroup$
    – bill s
    Jan 20, 2018 at 15:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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