Problem is based on equality of dimension.
Step 1: As we don't know any relation between known [ρ,S,f] and unknown [d] quantity, lets us take unknown on LHS and equate it with known on RHS, with each factor in product form and raised to some arbitrary powers say x,y & z
d=ρx×Sy×fz .......(1)
Step 2: Express the data in its fundamental (base) quantity
Distance [d]=[L]
Density [ρ]=[ML−3]
Intensity [S]=[MT−3]
Frequency[f]=[T−1]
Step 3: By equality of dimension analysis, dimensions on LHS should be equal to that in RHS
[L]=[ML−3]x[MT−3]y[T−1]z
[L]=[Mx+y][L−3x][T−3y−z] ............arranging
On equating LHS and RHS, we get,
x+y=0−3x=1&−3y−z=0
x=−13 y=13&z=−1
Substitution in (1) yields,
d=ρ−1/3×S1/3×f−1
Step 4: Comparison with S1/n with S1/3 gives:
n=3