The arithmetic mean \( \bar{x} \) of a frequency distribution is given by the formula:
\[
\bar{x} = \frac{\sum f_i x_i}{\sum f_i},
\]
where \( f_i \) are the frequencies and \( x_i \) are the corresponding values.
The given arithmetic mean is \( 21.5 \), so:
\[
21.5 = \frac{\sum f_i x_i}{\sum f_i}.
\]
Step 1: Find \( \sum f_i \)
We can find \( \sum f_i \) by adding all the frequencies:
\[
\sum f_i = 6 + 4 + 3 + p + 2 = 15 + p.
\]
Step 2: Find \( \sum f_i x_i \)
Next, calculate \( f_i x_i \) for each value of \( x_i \):
\[
f_1 x_1 = 6 \times 5 = 30, \quad f_2 x_2 = 4 \times 15 = 60, \quad f_3 x_3 = 3 \times 25 = 75, \quad f_4 x_4 = p \times 35 = 35p, \quad f_5 x_5 = 2 \times 45 = 90.
\]
So,
\[
\sum f_i x_i = 30 + 60 + 75 + 35p + 90 = 255 + 35p.
\]
Step 3: Set up the equation for the mean
Using the formula for the mean:
\[
21.5 = \frac{255 + 35p}{15 + p}.
\]
Step 4: Solve for \( p \)
Multiply both sides by \( 15 + p \):
\[
21.5(15 + p) = 255 + 35p.
\]
Expanding both sides:
\[
322.5 + 21.5p = 255 + 35p.
\]
Now, simplify and solve for \( p \):
\[
322.5 - 255 = 35p - 21.5p,
\]
\[
67.5 = 13.5p,
\]
\[
p = \frac{67.5}{13.5} = 5.
\]
Conclusion:
The value of \( p \) is 5.