Answer:
d = (a[n2] -a[n1])/(n2 -n1)
a1 = a[n1] -d(n1 -1)
Explanation:
The generic term is ...
an = a1 +d(n -1)
Fill in the values associated with the two terms and solve the simultaneous equations.
For terms n1 and n2, their difference will be ...
a[n2] -a[n1] = (a1 +d(n2 -1)) -(a1 +d(n1 -1)) = d(n2 -n1)
Dividing by the coefficient of d tells you ...
d = (a[n2] -a[n1])/(n2 -n1)
Once you have the value of d, you can find the first term.
a[n1] = a1 +d(n1 -1)
a1 = a[n1] -d(n1 -1)
_____
Example:
3rd term = 12
7th term = 20
d = (20 -12)/(7 -3) = 8/4 = 2
a1 = a3 -d(3 -1) = 12 -2(2) = 8
The n-th term is ...
an = a1 +d(n -1)
an = 8 +2(n -1)