Monday, March 06, 2006

 

Maths Qn

After getting home, dwin asked me a maths qn, not because he doesn't know how to do it, but just to let me try. Sadly, my maths is getting really rusty and it took me a long time and lots of hints from zq to work this one out.

The question was first to find a nice simplified expression for 1/(1*2) + 1/(2*3) + 1/(3*4) +...
Each term is basically 1/[n(n+1)] which is 1/n - 1/(n+1). When it is all summed up, all the intermediate terms conveniently cancel out, leaving 1 - 1/(n+1).

Ok, so that's part 1. Part 2 is to find the sum of 2/(1*2*3) + 2/(2*3*4) + 2/(3*4*5) +...+2/(1997*1998*1999) + 2/(1998*1999*2000).

My first instinct was to write a program to solve it. After all, there's an obvious pattern and the number of terms are finite. In Java, the exact code would be

double sum=0;
double n=1;
for (n=n;n<1998;n++) {
sum += 2/(n*(n+1)*(n+2));
}
System.out.println(sum);

and in a couple of seconds, the program will compile and give you the answer. How wonderful.

Unfortunately, I don't think that's what they were looking for. The examiners would probably want a nice answer in a very precise fraction, and I wouldn't have my java compiler in a maths exam.

After many hints from zq (ok he basically told me the answer), I figured out that I shouldn't split it fully into partial fractions, but instead express it as 1/n(1/(n+1) - 1/(n+2)). The 2 can be multiplied back later.

This gives 2 * sigma[n=1,1998] {1/n - 1/(n+1)} - sigma[n=1,1998] {1/n - 1/(n+2)}. The 2 in the second term cancels out the denominator you would get by splitting 1/[n(n+2)].

If you write out a few terms for each sigma bit, you would realise that the terms cancel out. The first one is an exact duplicate of the 1st part of the question, so you get 2*(1-1/1999).

The 2nd halfway is a little trickier, but nearly all terms still cancel out, leaving (1+1/2-1/2000).
Thus the final expression is 2*(1 - 1/1999) - (1 + 1/2 - 1/2000).

Simplified, it gives 1/2 - 2/1999 + 1/2000.

While this answer is very close to the one I got from my java program, it's not exactly the same. Shall have to ask dwin if the discrepancy is due to rounding errors or maybe my answer is wrong. If anyone finds any errors, please inform me, thanks.

For those who want to know, the answer given by my java prog is 0.49999974962456195.
Calculating a decimal number from the fractional expression in java gives 0.499499499749875.
So the difference is 0.00050024987468695.

posted by cosine  @ 12:16 PM
Comments: Post a Comment



<< Home


Other Blogs

  • Christopher
  • Hock
  • Chee Hui
  • Joline
  • YH
  • Zhiqin
  • Kenny
  • J.X.
  • Tubby
  • Esther Goh
  • Sarah
  • Dwin
  • Licia
  • External Links

  • Image Host--Applerings
  • Google
  • Previous Posts

  • William's party
  • More headers...
  • More changes
  • Changed Header
  • Timo's template
  • Countdown timer
  • Munich
  • Timer works!!!
  • 1st post
  • Archives

  • February 2006
  • March 2006
  • April 2006
  • May 2006
  • June 2006
  • July 2006
  • August 2006
  • September 2006
  • October 2006
  • November 2006
  • December 2006
  • January 2007
  • February 2007
  • March 2007
  • April 2007
  • May 2007
  • June 2007
  • July 2007
  • August 2007
  • September 2007
  • October 2007
  • November 2007
  • December 2007
  • January 2008
  • May 2008
  • July 2008