No. of squares of area n2 square units =12
No. of squares of area (n−1)2 square units =22
No. of squares of area (n−2)2 square units =32
.............................................
No. of squares of area 12 square units =n2
Adding gives N1=12+22+32+...+n2
=n(n+1)(2n+1)6
When n is even:
No. of squares of area n22 square units =12
No. of squares of area (n−2)22 square units =32
.......................................
No. of squares of area 222 square units =(n−1)2
Adding gives N2=12+32+52+...+(n−1)2
= n(n−1)(n+1)6
When n is odd:
No. of squares of area (n−1)22 square units =22
No. of squares of area (n−3)22 square units =42
No. of squares of area (n−5)22 square units =62
.......................................
No. of squares of area 222 square units =(n−1)2
Adding gives N2=22+42+62+...+(n−1)2
= n(n−1)(n+1)6
∴ Total no. of squares formed which can be obtained by taking 4 points out of (n+1)2 points =N1+N2
=n(n+1)(2n+1)6+n(n−1)(n+1)6
= n2(n+1)2
⇒k+m=1+2=3