If x-3y=p, ax+2y=q and ax+y=r form a right angled triangle, then
a2-6a-12=0
a2-9a+12=0
a2-9a+18=0
a2-6a-18=0
If x-3y=p and ax+2y=q are perpendicular, then 13.(−a2)=−1 i.e, a=6.......(1)
If x-3y=p and ax+y=r are perpendicular, then 13.(−a)=−1 i.e, a=3.......(2)
ax+2y=q and ax+y=r cannot be perpendicular, as −a2(−a)=−1⇒a2=−2 (not possible)
Thus, a = 6 or a = 3 or a2-9a+18=0