Finding pth term.
Given, am=n and an=m, where m≠n
Let d= common difference and a= first term
We have,
am=a+(m−1)d=n⋯(i)
an=a+(n−1)d=m⋯(ii)
Subtracting equation (i) and (ii)
⇒(m−1)d−(n−1)d=n−m
⇒md−d−nd+d=n−m
⇒(m−n)d=n−m
⇒d=−1 (Substitute in equation (i))
a+(m−1)(−1)=n
⇒a=n+(m−1)=n+m−1
Now, pth term
ap=a+(p−1)d
=(n+m−1)+(p−1)(−1)
=n+m−p
Hence, the pth term is n+m−p.