8

The following input

Assuming[
   (n ∈ Integers) && (n > 0) && (k ∈ Integers) && (k >= 0) && (k <= n), 
   FullSimplify[Binomial[n, k]/Binomial[n, k + 1]]
]

returns

Binomial[n,k]/Binomial[n,k+1]

Why does it not give

(k+1)/(n-k)

and how do I make it do this?

rm -rf
  • 88,781
  • 21
  • 293
  • 472
Lucas
  • 828
  • 4
  • 14

2 Answers2

14

Try using FunctionExpand:

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

Mathematica's understanding of what is simple is based on leaf count and can be unintuitive at times.

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
Searke
  • 4,404
  • 20
  • 23
  • perfect, thanks Searke – Lucas Nov 29 '12 at 00:24
  • 1
    LeafCount indeed gets you a complexity of 11 for both terms. Using the written size of the expression with ComplexityFunction -> (StringLength@ToString[#] &)] still yields the same result, though FullSimplify now delivers the version that the OP wants. – Sjoerd C. de Vries Nov 29 '12 at 16:05
  • Somehow, I have never considered StringLength as a ComplexityFunction until now. – Searke Nov 29 '12 at 16:06
10

Another way to proceed would be to make Binomial more expensive (or less simple) using a ComplexityFunction:

f[e_] := 100 Count[e, _Binomial, {0, Infinity}] + LeafCount[e]

FullSimplify[Binomial[n, k]/Binomial[n, k + 1], ComplexityFunction -> f]

gives

(1 + k)/(-k + n)
J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
WalkingRandomly
  • 4,107
  • 1
  • 20
  • 36
  • 1
    Sounds, erm, complex. But it is interesting and good to know. – Lucas Nov 29 '12 at 00:32
  • It is interesting, that Simplify[Binomial[n, k]/Binomial[n, 1 + k], ComplexityFunction -> f] with your definition for f gives Binomial[n, k]/Binomial[n, 1 + k]. It looks like Simplify does not try enough transformations of Binomial. – au700 Nov 29 '12 at 00:34
  • 1
    Probably. You could perhaps find out using another recent Q+A of mine http://mathematica.stackexchange.com/questions/15321/how-can-i-see-which-transformations-simplify-attempts/ – WalkingRandomly Nov 29 '12 at 00:39
  • @WalkingRandomly It is overkill 100 Count..., 1 Count... is good enough, +1. – Artes Nov 30 '12 at 00:43