Consider the following recurrence relation The value of T(m2) for m ≥ 1 is

2003

Consider the following recurrence relation
GATECS2003Q35
The value of T(m2) for m ≥ 1 is

  1. A.

    (m/6) (21m - 39) + 4

  2. B.

    (m/6) (4m2 - 3m + 5)

  3. C.

    (m/2) (m2.5 - 11m + 20) - 5

  4. D.

    (m/6) (5m3 - 34m2 + 137m - 104) + (5/6)

Attempted by 31 students.

Show answer & explanation

Correct answer: B

We have T(1) = 1 and T(n+1) = T(n) + floor(sqrt(n+1)). Therefore

T(m^2) = T(1) + sum_{i=2}^{m^2} floor(sqrt(i)) = 1 + (sum_{i=1}^{m^2} floor(sqrt(i)) - 1) = sum_{i=1}^{m^2} floor(sqrt(i)).

  1. Group terms by the value of floor(sqrt(i)). For j = 1,2,...,m-1, floor(sqrt(i)) = j for i = j^2,...,(j+1)^2 - 1, which gives 2j+1 terms. For j = m only i = m^2 is included, giving 1 term.

  2. Thus sum_{i=1}^{m^2} floor(sqrt(i)) = sum_{j=1}^{m-1} j(2j+1) + m.

  3. Evaluate the sums: sum_{j=1}^{m-1} j(2j+1) = 2 sum_{j=1}^{m-1} j^2 + sum_{j=1}^{m-1} j.

  4. Use closed forms: sum_{j=1}^{m-1} j = (m-1)m/2 and sum_{j=1}^{m-1} j^2 = (m-1)m(2m-1)/6. Substituting gives

  5. sum_{i=1}^{m^2} floor(sqrt(i)) = 2 * (m-1)m(2m-1)/6 + (m-1)m/2 + m = (4m^3 - 3m^2 + 5m)/6.

  6. Therefore T(m^2) = (4m^3 - 3m^2 + 5m)/6 = (m/6)(4m^2 - 3m + 5).

Final answer: T(m^2) = (m/6)(4m^2 - 3m + 5).

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir