The distance between the two points #(x_1,y_1)# and #(x_2,y_2)# is given as #d=sqrt((x_2-x_1)^2+(y_2-y_1)^2)#.

For this problem, it is given that #(x_1,y_1)=(5,8)#, #(x_2,y_2)=(a,2)#, and #d=3sqrt5#. We need to solve for #a# by plugging these values into the distance formula.

#3sqrt5=sqrt((a-5)^2+(2-8)^2)#.

To solve for #a#, begin by squaring both sides of the equation and simplify a bit.

#(3sqrt5)^color(green)2=sqrt((a-5)^2+(2-8)^2)^color(green)2#

#3^2sqrt5^2=sqrt((a-5)^2+(2-8)^2)^2#

#9*5=(a-5)^2+(2-8)^2#

#45=(a-5)^2+("-"6)^2#

#45=a^2-10a+25+36#

#45=a^2-10a+61#

Now subtract 45 from both sides to get an equation in quadratic form.

#45color(green)(-45)=a^2-10a+61color(green)(-45)#

#0=a^2-10a+16#

Finally, solve for #a# using either the quadratic formula or the factoring method. I'll be factoring.

#0=a^2-2a-8a+16#

#0=a(a-2)-8(a-2)#

#0=(a-8)(a-2)#

#a=8or2#

Therefore the possible values for #a# are defined by the set #{a:a=2,8}#