tf is the square root of the number of times a term occurs in a particular document.
idf is (log times (the total no of documents divided by the no of documents containing the term)) plus 1 in case the term occurs zero times [shouldn't be divided by 0].
Sathish