# Expansion with binomial coefficients

How can I get binomial coefficients in expansion of $(n x+i) (1+i x)^n+(n x-i) (1-i x)^n$, where $i=\sqrt{-1}$ and $n$ is an integer. I have no idea how to coax Mathematica to do something remotely close to this without doing a lot of copying and pasting as if I was doing it by hand. If possible, I like the coefficients given in binomial notation.

-
Would help if actual Mathematica input was provided.. –  Daniel Lichtblau Jan 8 at 17:58
you mean: (1 - I x)^n (-I + n x) + (1 + I x)^n (I + n x)? –  user2943324 Jan 8 at 18:00
Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! –  belisarius Jan 8 at 18:21

It is difficult to automatically obtain such expansion. However, we can make сhain of identical transformations

I (1 - I n x) (1 + I x)^n - I (1 + I n x) (1 - I x)^n // FullSimplify

I (1 - I n x) Sum[Binomial[n, m] (I x)^m, {m, 0, n}] -
I (1 + I n x) Sum[Binomial[n, m] (-I x)^m, {m, 0, n}] // FullSimplify

I (1 - I n x) Sum[Binomial[n, m] (I x)^m, {m, 0, n}] -
I (1 + I n x) Sum[Binomial[n, m] (-I x)^m, {m, 0, n}] // FullSimplify

2 I Sum[Binomial[n, m] (I x)^m, {m, 1, n, 2}] +
2 n x Sum[Binomial[n, m] (I x)^m, {m, 0, n, 2}] // FullSimplify

2 I Sum[Binomial[n, m] (I x)^m, {m, 1, n, 2}] -
2 n I Sum[Binomial[n, m - 1] (I x)^m, {m, 1, n + 1, 2}] // FullSimplify

Sum[2 I (Binomial[n, m] - n Binomial[n, m - 1]) (I x)^m, {m, 1, n + 1,
2}] // FullSimplify

Sum[2 I (Binomial[n, 2 j + 1] - n Binomial[n, 2 j]) (I x)^(2 j + 1),
{j, 1, (n + 1)/2}] // FullSimplify


Each line outputs

(1 - I x)^n (-I + n x) + (1 + I x)^n (I + n x)


Finally, the expansion is

Sum[2 I (Binomial[n, 2 j + 1] - n Binomial[n, 2 j]) (I x)^(2 j + 1),
{j, 1, (n + 1)/2}] // HoldForm // TraditionalForm


$$\sum _{j=1}^{\frac{n+1}{2}} 2 i \left(\binom{n}{2 j+1}-n \binom{n}{2 j}\right) (i x)^{2 j+1}$$

-
That's very nice. Thank you. It is easy to see that those pesky $i$'s go away. I did get the same expression doing it by hand (of course with no $i$'s in it). I wish I could also accept this as the answer. –  user2943324 Jan 8 at 23:28
With all due respect to Daniel, I think this reply meets the conditions I set in my question better. So, I'll switch my accepted answer. I wish I could accept both. –  user2943324 Jan 9 at 0:32
Heartbroken though I am over the loss of credit, I'm fully in agreement with the outcome here. (Actually I thought of noting yesterday that you might have accepted my response too soon, and should feel free to undo that. I would have sent it today had you not made the change.) –  Daniel Lichtblau Jan 9 at 16:29

If you mean to do this for general n then this is something that "works", after a fashion.

ee = (1 - I x)^n (-I + n x) + (1 + I x)^n (I + n x);

ss =
SeriesCoefficient[ee, {x, 0, j},
Assumptions -> 0 <= j <= n && Element[n, Integers]];


The result is in terms of ghastly DifferenceRoot objects. It evaluates nicely though, and in a way that gives functions of n (as it ought).

Table[ss, {j, 0, 10}]

(* Out[16]= {0, 0, 0, -2 (-(1/6) (-2 + n) (-1 + n) n +
1/2 (-1 + n) n^2), 0,
2 (-(1/120) (-4 + n) (-3 + n) (-2 + n) (-1 + n) n +
1/24 (-3 + n) (-2 + n) (-1 +
n) n^2), 0, -2 (-(((-6 + n) (-5 + n) (-4 + n) (-3 + n) (-2 +
n) (-1 + n) n)/5040) +
1/720 (-5 + n) (-4 + n) (-3 + n) (-2 + n) (-1 + n) n^2), 0,
2 (-(1/362880)(-8 + n) (-7 + n) (-6 + n) (-5 + n) (-4 + n) (-3 +
n) (-2 + n) (-1 + n) n + ((-7 + n) (-6 + n) (-5 + n) (-4 +
n) (-3 + n) (-2 + n) (-1 + n) n^2)/40320), 0} *)

-
Thank you. That's a lot more than what I was able to accomplish. I need to study your reply tho :) –  user2943324 Jan 8 at 18:16
Now that I understand what that output means, it seems I have to it by hand. But I thank you for taking the time to answer. –  user2943324 Jan 8 at 18:35
Unless you are versed in DifferenceRoot understanding, I'd not give that aspect much thought (I'm not, and I didn't). Just treat it as a black box is what I recommend (and do). –  Daniel Lichtblau Jan 8 at 18:41