The total charge \(q\) is distributed uniformly forming a ring as shown in Figure 1. The charge is uniformly distributed in the ring and so we apply the symmetry to find the total electric field of the ring of charge at a point \(p\). In our coordinate system the origin is the centre of the ring and x-axis is perpendicular to the imaginary plane of the ring. The point \(p\) where the electric field is being calculated lies at a perpendicular distance \(x\) (x-coordinate of point \(p\)) from the centre of the ring. We divide the entire charge on the ring into small charge elements such as \(dq\) and add the electric fields produced by every element at the point \(p\).

Figure 1 Electric field due to a ring of charge at a point p. The point \(p\) lies at a perpendicular distance \(x\) from the imaginary plane of the ring.

Note that each element has both x and y-components of electric field but the y-component is cancelled by the y-component of the opposite charge element in the ring. Therefore the electric field at the point \(p\) is only due to the x-component of electric field due to charge elements. In Figure 1 let the radius of the ring be \(R\), so the distance between the charge element \(dq\) and the point \(p\) is \(r = \sqrt {{x^2} + {R^2}} \) and the electric field \(dE\) at that point due to this charge element is

\[dE = k\frac{{dq}}{{({x^2} + {R^2})}}\]

If you consider the symmetry of the charge distribution you'll find that the y-component of electric field due to one element is cancelled by the the y-component of electric field due to the opposite element in the ring. So the sum of the y-components of electric field due to the entire ring of charge is zero as already noted. Thus the total electric field at the point is the sum of the x-components of electric fields due to all charge elements in the ring. The x-component of the small electric field \(dE\) is \(d{{E}_{x}}=dE\cos \theta \) and \(\cos \theta =\frac{x}{r}\). So,

\[d{E_x} = k\frac{{xdq}}{{{{({x^2} + {R^2})}^{\frac{3}{2}}}}}\]

Now we integrate this expression to get the electric field due to the entire ring of charge. Note that \(x\) and \(R\) remain constant throughout the whole integration and therefore,

\[{E_x} = E = k\frac{{xq}}{{{{({x^2} + {R^2})}^{\frac{3}{2}}}}} \tag{1} \label{1}\]

If the unit vector \(\hat{i}\) is the unit vector along positive x-direction, the electric field in vector form is

\[\vec E = k\frac{{xq}}{{{{({x^2} + {R^2})}^{\frac{3}{2}}}}}\hat i \tag{2} \label{2}\]

If the point \(p\) is far enough from the ring that is, \(x >> R\). In this case the term \({{R}^{2}}\) can be neglected and the electric field becomes

\[E = k\frac{q}{{{x^2}}} \tag{3} \label{3}\]

Which is the electric field for a charge at a point. It means the entire ring acts as a point charge \(q\) if the point \(p\) is far enough from the centre of the ring. Now you can easily get the answer for another condition as what if the point \(p\) lies at the centre of the ring. For this the value \(x\) is zero and the electric field is also zero.