we know that
the formula for the arithmetic sequence is
an=a1+d(n-1)
for a2=24 n=2
24=a1+d(2-1)-----> 24=a1+d-----> equation 1
for a5=3 n=5
3=a1+d(5-1)----->3=a1+4d-----> equation 2
multiply equation 1 by -1 and adds to equation 2
-24=-a1-d
3=a1+4d
-------------------
-21=3d
d=-7
24=a1+d-----> 24=a1-7-----> a1=24+7------> a1=31
the answer is
the first term is 31 and the common difference is -7