8
$\begingroup$

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?

$\endgroup$

2 Answers 2

14
$\begingroup$

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.

$\endgroup$
3
  • $\begingroup$ perfect, thanks Searke $\endgroup$
    – Lucas
    Nov 29, 2012 at 0:24
  • 1
    $\begingroup$ 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. $\endgroup$ Nov 29, 2012 at 16:05
  • $\begingroup$ Somehow, I have never considered StringLength as a ComplexityFunction until now. $\endgroup$
    – Searke
    Nov 29, 2012 at 16:06
10
$\begingroup$

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)
$\endgroup$
4
  • 1
    $\begingroup$ Sounds, erm, complex. But it is interesting and good to know. $\endgroup$
    – Lucas
    Nov 29, 2012 at 0:32
  • $\begingroup$ 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. $\endgroup$
    – au700
    Nov 29, 2012 at 0:34
  • 1
    $\begingroup$ Probably. You could perhaps find out using another recent Q+A of mine mathematica.stackexchange.com/questions/15321/… $\endgroup$ Nov 29, 2012 at 0:39
  • $\begingroup$ @WalkingRandomly It is overkill 100 Count..., 1 Count... is good enough, +1. $\endgroup$
    – Artes
    Nov 30, 2012 at 0:43

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.