Let the average age of people aged 51 years and above be x years. Let the average age of people aged below 51 years be y years. Let the number of people aged below 51 years be N. Let the number of people aged below 51 years be N. Given, the average age of all the people in the apartment complex is 38 years. Therefore, ‌
x×30+y×N
30+N
=38.....(1) We want to maximize y, which occurs when x is minimum i.e. for x=51. Substituting the value of x in (1) we get 390=N×(38−y) Again, when y is maximum, N is also maximum i.e. 39 Therefore maximum value of y=28.