Let a be a positive integer and b=3.
By Euclid's division lemma, we get a=3q+r,0≤r<3 , where q is a positive integer.
If r=0 we get a=3q
Cubing a=3q on both sides
a3=(3q)3
=9(3q3)
a3=9m where m=3q3
If r=1 we get a=3q+1
Cubing a=3q+1 on both sides
a3=(3q+1)3
=(3q)3+3(3q2)(1)+3(3q)(1)2+(1)3
=27q3+27q2+9q+1
=9(3q3+3q2+q)+1
a3=9m+1 where m=3q3+3q2+q
If, r=2 we get a=3q+2
Cubing a=3q+2 on both sides
a3=(3q+2)3
=(3q)3+3(3q)2(2)+3(3q)(2)3
=27q3+54q2+36q+8
=9(3q3+6q2+4q)+8
a3=9m+8 where m=3q3+6q2+4q
Hence cube of any positive integer is of the form 9mor9m+1or9m+8