It is known that $${ \left( r+1 \right) }^{ th }$$ term, $$({T}_{r+1}),$$ in the binomial expansion of $${ \left( a+b \right) }^{ n }$$ is given by $${ T }_{ r+1 }=^{ n }{ { C }_{ r } }{ a }^{ n-r }{ b }^{ r }.$$ Assuming that $${x}^{2}$$ occurs in the $${ \left( r+1 \right) }^{ th }$$ term in the expansion of $${ \left( 3+ax \right) }^{ 9 },$$ we obtain
$${ T }_{ r+1 }=^{ 9 }{ { C }_{ r } }{ \left( 3 \right) }^{ 9-r }=^{ 9 }{ { C }_{ r } }{ \left( 3 \right) }^{ 9-r }{ a }^{ r }{ x }^{ r }$$
Comparing the indices of $$x$$ in $${x}^{2}$$ and in $${T}_{r+1},$$ we obtain $$r=2.$$
Thus, the coefficients of $${x}^{2}$$ is $$\displaystyle ^{ 9 }{ { C }_{ 2 }{ \left( 3 \right) }^{ 9-2 } }{ a }^{ 2 }=\frac { 9! }{ 2!7! } { \left( 3 \right) }^{ 7 }{ a }^{ 2 }=36{ \left( 3 \right) }^{ 7 }{ a }^{ 2 }.$$
Arruming that $${x}^{3}$$ occurs in the $${ \left( k+1 \right) }^{ n }$$ term in the expansion of $${ \left( 3+ax \right) }^{ 9 },$$ we obtain
$${ T }_{ k+1 }=^{ 9 }{ { C }_{ k } }{ \left( 3 \right) }^{ 9-k }{ \left( ax \right) }^{ k }=^{ 9 }{ { C }_{ k } }{ \left( 3 \right) }^{ 9-k }{ a }^{ k }{ x }^{ k }$$
Comparing the indices of $$x$$ in $${x}^{3}$$ and $${T}_{k+1},$$ we obtain $$k=3$$
Thus, the coefficient of $${x}^{3}$$ is $$\displaystyle ^{ 9 }{ { C }_{ 3 } }{ \left( 3 \right) }^{ 9-3 }{ a }^{ 3 }=\frac { 9! }{ 3!6! } { \left( 3 \right) }^{ 6 }{ a }^{ 3 }=84{ \left( 3 \right) }^{ 6 }{ a }^{ 3 }$$
In is given that the coefficient of $${x}^{2}$$ and $${x}^{3}$$ are the same,
$$\displaystyle 84{ \left( 3 \right) }^{ 6 }{ a }^{ 3 }=36{ \left( 3 \right) }^{ 7 }{ a }^{ 2 }\Rightarrow 84a=36\times 3\Rightarrow a=\frac { 36\times 3 }{ 84 } =\frac { 104 }{ 84 } \Rightarrow a=\frac { 9 }{ 7 } $$
Thus, the required value of $$a$$ is $$\displaystyle \frac{9}{7} $$