Trinomial Coefficient

Author

Eric W. Weisstein
January 13, 2012

This notebook downloaded from http://mathworld.wolfram.com/notebooks/Combinatorics/TrinomialCoefficient.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/TrinomialCoefficient.html.

©2011 Wolfram Research, Inc. except for portions noted otherwise

Closed Form

V8

SeriesCoefficient[(((1+x+(x^2)))^n),{x,0,n+k}]

Enumeration

Column[Table[T[n,k],{n,0,3},{k,-n,n}],Alignment->Center]//TraditionalForm

Andrews Definition

Table[Trinomial[n,k],{n,0,7},{k,-n,n}]//ColumnForm

Generating Function

Table[SeriesCoefficient[(((1+x+(x^2)))^n),{x,0,n+k}],{n,0,7},{k,-n,n}]//Column

Multinomial Definition

Table[Multinomial[n,k],{n,0,7},{k,0,n}]//ColumnForm

Table[Expand[(x+y+z)^n],{n,4}]//ColumnForm

Gegenbauer Defnition

Table[GegenbauerC[k+n,-n,-(1/2)],{n,0,7},{k,-n,n}]//ColumnForm

Permutations

p[n_]:=Tuples[{-1,0,1},{n}]

p[3]

Select[p[3],Total[#]==0&]

Length[%]

tri[n_,k_]:=Count[Plus@@@p[n],k]

Table[tri[n,k],{n,4},{k,-n,n}]

Alternate Definition

Expand[Table[(x+y+z)^n,{n,5}]]

Generating Function

Trinomial[n,k]

FullSimplify[((n! Hypergeometric2F1Regularized[((k-n)/2),(1/2) (1+k-n),1+k,4])/((-k+n)!))-GegenbauerC[k+n,-n,-(1/2)],-n≤k≤n]

FunctionExpand[GegenbauerC[k+n,-n,-(1/2)]]

-GegenbauerC[k+n,-n,-(1/2)]+((n! Hypergeometric2F1Regularized[((k-n)/2),(1/2) (1+k-n),1+k,4])/((-k+n)!))/.{n->4,k->3}

SeriesCoefficient[(((1+x+(x^2)))^n),{x,0,n+k}]

(Subscript[C, k+n]^((-n)))(-(1/2))

GeneratingFunction[GegenbauerC[k+n,-n,-(1/2)],{z,0,n},{w,0,k}]

1+Sum[GegenbauerC[k+n,-n,-(1/2)](z^n)(w^(n+k)),{n,0,∞},{k,-n,n}]

{1+Sum[GegenbauerC[k+n,-n,-(1/2)](z^n)(w^(n+k)),{n,0,100},{k,-n,n}],(1/(1-z(1+w+(w^2))))}/.{z->.2,w->.7}

Series[1+Sum[GegenbauerC[k+n,-n,-(1/2)](w^(n+k))(z^n),{n,0,10},{k,-n,n}],{z,0,5},{w,0,8}]

Series[(1/(1-z(1+w+(w^2)))),{z,0,5},{w,0,8}]

Sums

(∑_(k=-n)^n)(x^k) (Subscript[C, k+n]^((-n)))(-(1/2))+1==(((x+(1/x)+1))^n)

1+Sum[GegenbauerC[k+n,-n,-(1/2)](x^k),{k,-n,n}]

Table[%,{n,4}]//Expand

Table[(((1+x+(x^(-1))))^n),{n,4}]//Expand

(∑_(n=0)^∞)(∑_(k=-n)^n)(z^n) (Subscript[C, k+n]^((-n)))(-(1/2)) (w^(k+n))+1==(1/(1-((w^2)+w+1) z))

1+Sum[GegenbauerC[k+n,-n,-(1/2)](z^n)(w^(n+k)),{n,0,∞},{k,-n,n}]

{1+Sum[GegenbauerC[k+n,-n,-(1/2)](z^n)(w^(n+k)),{n,0,100},{k,-n,n}],(1/(1-z(1+w+(w^2))))}/.{z->.2,w->.7}

(∑_(j=0)^n)((n!)/(j! (j+k)! (-2 j-k+n)!))

V6

FullSimplify[Sum[((n!)/(j!(j+k)!(n-2j-k)!)),{j,0,n}],(k|n)∈Integers&&n≥0&&-n≤k≤n]//TraditionalForm

Table[((n! Hypergeometric2F1Regularized[((k-n)/2),(1/2) (1+k-n),1+k,4])/((-k+n)!)),{n,0,5},{k,-n,n}]

V7

Table[Sum[((n!)/(j!(j+k)!(n-2j-k)!)),{j,0,n}],{n,0,5},{k,-n,n}]

Sum[((n!)/(j!(j+k)!(n-2j-k)!)),{j,0,n}]

...wrong...

%/.{n->5,k->-4}

Table[If[n==0,1,GegenbauerC[k+n,-n,-(1/2)]],{n,0,5},{k,-n,n}]

(∑_(j=0)^n)(((-1))^j) (Binomial[n, j]) (Binomial[2 n-2 j, -j-k+n])==(Binomial[2 n, n-k]) (Hypergeometric2F1[k-n, -k-n, (1/2)-n, (1/4)])

V6

FullSimplify[Sum[(((-1))^j)Binomial[n,j]Binomial[2n-2j,n-k-j],{j,0,n}],(k|n)∈Integers&&n≥0&&-n≤k≤n]//TraditionalForm

Table[Sum[(((-1))^j)Binomial[n,j]Binomial[2n-2j,n-k-j],{j,0,n}],{n,0,5},{k,-n,n}]

Table[(((2 n)! Hypergeometric2F1[-k-n,k-n,(1/2)-n,(1/4)])/((-k+n)! (k+n)!)),{n,0,5},{k,-n,n}]

V7

Sum[(((-1))^j)Binomial[n,j]Binomial[2n-2j,n-k-j],{j,0,n}]

Table[Binomial[2 n,-k+n] Hypergeometric2F1[k-n,-k-n,(1/2)-n,(1/4)],{n,0,5},{k,-n,n}]

Table[If[n==0,1,GegenbauerC[k+n,-n,-(1/2)]],{n,0,5},{k,-n,n}]

Columns

FullSimplify[GegenbauerC[k+n,-n,-(1/2)]/.k->1,n∈Integers&&n>0]

Table[GegenbauerC[1+n,-n,-(1/2)],{n,20}]

{n!Hypergeometric2F1Regularized[(k-n)/2,(1+k-n)/2,1+k,4]/(n-k)!,GegenbauerC[k+n,-n,-(1/2)]}/.{n->0,k->0}

Table[GegenbauerC[k+n,-n,-(1/2)],{k,0,5},{n,k,k+7}]//ColumnForm

Table[Trinomial[n,k],{k,0,5},{n,k,k+7}]//ColumnForm

Central Column (Subscript[(({{n}, {0}})), 2])

Table[CentralTrinomial[n],{n,0,10}]

Series[1/(1+x)^(1/2 )/(1-3x)^(1/2),{x,0,10}]

Table[Series[(1+x+1/x)^k,{x,0,10}],{k,1,4}]//MatrixForm

Trinomial2[n_,m_]:=Module[{j},Sum[n!/j!/(j+m)!/(n-2j-m)!,{j,0,n}]]

Table[Trinomial2[n,k],{n,0,7},{k,-n,n}]//MatrixForm

Trinomial3[n_,m_]:=Module[{j},Sum[(-1)^j Binomial[n,j]Binomial[2n-2j,n-m-j],{j,0,n}]]

Table[Trinomial3[n,k],{n,0,7},{k,-n,n}]//MatrixForm

First Column (Subscript[(({{n}, {1}})), 2])

FullSimplify[Trinomial[n,1]]

Table[n Hypergeometric2F1[((1-n)/2),1-(n/2),2,4],{n,10}]

Table[Hypergeometric2F1[((1-n)/2),1-(n/2),2,4],{n,10}]

Table[Trinomial[n,1]/n,{n,20}]

Table[Trinomial[n+1,1]/(n+1),{n,0,20}]

Motzkin numbers

Diagonals

Factor[FullSimplify[FunctionExpand[Table[Trinomial[n,n-k],{k,8}]]]]//ColumnForm//TraditionalForm

Primes

Table[Trinomial[n,k],{n,0,10},{k,0,n}]//TableForm

(primes=Position[Table[Trinomial[n,k],{n,0,2000},{k,0,n}],_?PrimeQ]-1)//Timing

exc=Select[primes,Subtract@@#≠1||!PrimeQ[First[#]]&]

p=First/@DeleteCases[primes,Alternatives@@exc]

p==Prime[Range[PrimePi[Last[p]]]]

Euler Near-Identity

Euler's Case

FullSimplify[Subtract@@{3Trinomial[n+1,0]-Trinomial[n+2,0],Fibonacci[n](Fibonacci[n]+1)},n∈Integers&&n>0]

Table[3Trinomial[n+1,0]-Trinomial[n+2,0],{n,0,10}]

Table[Fibonacci[n](Fibonacci[n]+1),{n,0,10}]

General Sum (∑_(k=-∞)^∞)(Subscript[(({{n}, {a+10 k}})), 2])

Sum[Trinomial[n,10k+a],{k,-∞,∞}]//Timing

Trinomial[n,k]//InputForm

v5.1

Sum[Trinomial[n,10k],{k,-∞,∞}]//Timing

Sum[Trinomial[n,10k+1],{k,-∞,∞}]//Timing

Sum[Trinomial[n,10k+2],{k,-∞,∞}]//Timing

Sum[Trinomial[n,10k+3],{k,-∞,∞}]//Timing

Sum[Trinomial[n,10k+4],{k,-∞,∞}]//Timing

Sum[Trinomial[n,10k+5],{k,-∞,∞}]//Timing

v6

Sum[Trinomial[n,10k],{k,-∞,∞}]//Timing

Sum[Trinomial[n,10k+1],{k,-∞,∞}]//Timing

Sum[Trinomial[n,10k+2],{k,-∞,∞}]//Timing

Sum[Trinomial[n,10k+3],{k,-∞,∞}]//Timing

Sum[Trinomial[n,10k+4],{k,-∞,∞}]//Timing

Sum[Trinomial[n,10k+5],{k,-∞,∞}]//Timing

V7

Sum[Trinomial[n,a+10k],{k,-∞,∞}]

(∑_(k=-∞)^∞)((Subscript[(({{n}, {a+10 k}})), 2])-(Subscript[(({{n}, {b+10 k}})), 2]))

v5.1

Sum[Trinomial[n,10k+a]-Trinomial[n,10k+b],{k,-∞,∞}]//Timing

ℰ[m_,{a_,b_}]:=Sum[Trinomial[n,10k+a]-Trinomial[n,10k+b],{k,-∞,∞}]

ℰ[m+1,{0,1}]//Timing

v6

Sum[Trinomial[n,10k+a]-Trinomial[n,10k+b],{k,-∞,∞}]//Timing

ℰ[m_,{a_,b_}]:=Sum[Trinomial[n,10k+a]-Trinomial[n,10k+b],{k,-∞,∞}]

ℰ[m+1,{0,1}]//Timing

V7

T[n_,k_]:=Binomial[2 n,-k+n] Hypergeometric2F1[k-n,-k-n,(1/2)-n,(1/4)]

ℰ[n_,{a_,b_}]:=sum[Trinomial[n,10k+a]-Trinomial[n,10k+b],{k,-∞,∞}]

Sum[Trinomial[n,10k+a]-Trinomial[n,10k+b],{k,-∞,∞}]//Timing

Sum[T[n,10k+a]-T[n,10k+b],{k,-∞,∞}]//Timing

ℰ[n,{1,2}]

Sum[GegenbauerC[10 k+n,-n,-(1/2)]-GegenbauerC[3+10 k+n,-n,-(1/2)],{k,-∞,∞}]

Table[Sum[GegenbauerC[10 k+n,-n,-(1/2)]-GegenbauerC[3+10 k+n,-n,-(1/2)],{k,-100,100}],{n,4}]

Table[Fibonacci[n+1](Fibonacci[n+1]+1)/2,{n,4}]

With[{n=2},Sum[GegenbauerC[10 k+n,-n,-(1/2)]-GegenbauerC[3+10 k+n,-n,-(1/2)],{k,-∞,∞}]]

(1/2)Fibonacci[n](Fibonacci[n]+1)/.n->3

ℰ[n,{0,3}]

Identities

(Subscript[((n/k)), 2])==(Subscript[(((n-1)/(k-1))), 2])+(Subscript[(((n-1)/(k+1))), 2])+(Subscript[(((n-1)/k)), 2])

Table[Subtract@@{
Trinomial[n,k],
Trinomial[n-1,k-1]+Trinomial[n-1,k]+Trinomial[n-1,k+1]
},{n,4},{k,-n,n}]

Trinomial2[n_,k_]:=SeriesCoefficient[(((1+x+(x^2)))^n),{x,0,n+k}]

Table[Subtract@@{
Trinomial2[n,k],
Trinomial2[n-1,k-1]+Trinomial2[n-1,k]+Trinomial2[n-1,k+1]
},{n,4},{k,-n,n}]

FullSimplify[Subtract@@{
Trinomial[n,k],
Trinomial[n-1,k-1]+Trinomial[n-1,k]+Trinomial[n-1,k+1]
},n∈Integers&&n>0]

...right, but for wrong reason...

With[{k=5},Table[GegenbauerC[-2+k+n,1-n,-(1/2)]+GegenbauerC[-1+k+n,1-n,-(1/2)]+GegenbauerC[k+n,1-n,-(1/2)],{n,10}]]

FullSimplify[Table[GegenbauerC[-2+k+n,1-n,-(1/2)]+GegenbauerC[-1+k+n,1-n,-(1/2)]+GegenbauerC[k+n,1-n,-(1/2)],{n,10}],k∈Integers]

GegenbauerC[-2+k+n,1-n,-(1/2)]+GegenbauerC[-1+k+n,1-n,-(1/2)]+GegenbauerC[k+n,1-n,-(1/2)]/.n->10

With[{k=5},GegenbauerC[8+k,-9,-(1/2)]+GegenbauerC[9+k,-9,-(1/2)]+GegenbauerC[10+k,-9,-(1/2)]]//N

FullSimplify[k∈Integers]

FullSimplify[Trinomial[n-1,k-1]+Trinomial[n-1,k]+Trinomial[n-1,k+1],n∈Integers&&n>0]

FullSimplify[Trinomial[n-1,k-1]+Trinomial[n-1,k]+Trinomial[n-1,k+1],n∈Integers&&n>0]