Let A be represented by (a, 2, 1) and B be represented by (1, –1, 1)
Since distance between AB = 5
By squaring both sides,
i.e (a – 1)2 + 9 = 25
i.e a2 + 1 – 2a + 9 – 25 = 0
i.e a2 – 2a – 15 = 0
i.e a2 + 3a – 5a – 15 = 0
i.e a(a + 3) –5 (a + 3) = 0
i.e a = 5 or a = –3