The formula for percent composition is
#color(blue)(bar(ul(|color(white)(a/a)"% by mass" = "mass of component"/"mass of sample" × 100 %color(white)(a/a)|)))" "#
We must therefore find the masses of #"Al, O"#, and #"H"# in a given mass of the compound.
Let's choose 1 mol of #"Al(OH)"_3#.
We rewrite the formula as #"AlO"_3"H"_3# for easy calculation.
#"Mass of Al"color(white)(l) = color(white)(m) "1 × 26.98 g" color(white)(ll)= "26.98 g"#
#"Mass of O" = color(white)(ll)" 3 × 16.00 g" color(white)(ll)= "48.00 g"#
#"Mass of H"color(white)(l) = color(white)(ml)3 × color(white)(l)"1.008 g" color(white)(l) = color(white)(l) "3.024 g"#
#stackrel(——————————————————)("Mass of Al(OH)"_3color(white)(mmmmml) =color(white)(l) "78.004 g")#
#"% Al" = "mass of Al"/("mass of Al(OH)"_3) × 100 % = (26.98 color(red)(cancel(color(black)("g"))))/(78.004 color(red)(cancel(color(black)("g")))) × 100 % = 34.58 %#
#"% O" = "mass of O"/("mass of Al(OH)"_3) × 100 % = (48.00 color(red)(cancel(color(black)("g"))))/(78.004 color(red)(cancel(color(black)("g")))) × 100 % = 61.54 %#
#"% H" = "mass of H"/("mass of Al(OH)"_3) × 100 % = (3.024 color(red)(cancel(color(black)("g"))))/(78.004 color(red)(cancel(color(black)("g")))) × 100 % = 3.88 %#