Assume that you have 100 g of the compound.
Then you have 74.97 g of "Al and"25.03 g of "C".
Our job is to calculate the ratio of the moles of each element.
"Moles of Al" =74.97 color(red)(cancel(color(black)("g Al"))) × "1 mol Al"/(26.98 color(red)(cancel(color(black)("g Al")))) = "2.7787 mol Al"
"Moles of C" = 25.03 color(red)(cancel(color(black)("g C"))) × "1 mol C"/(12.01color(red)(cancel(color(black)("g C")))) = "2.0841 mol C"
To get the molar ratio, we divide each number of moles by the smaller number (2.0841).
From here on, I like to summarize the calculations in a table.
"Element"color(white)(X) "Mass/g"color(white)(X) "Moles"color(white)(XXl) "Ratio" color(white)(XX)"×2"color(white)(mm)"×3"color(white)(mll)"Integers"
stackrel(—————————————————-———)(color(white)(l)"Al" color(white)(XXXX)74.97 color(white)(Xlll)2.7787 color(white)(Xll)1.3333color(white)(X)2.6666)color(white)(l)3.9999color(white)(mm)4
color(white)(ll)"C" color(white)(XXXX)25.03 color(white)(XX)2.0841 color(white)(Xll)1 color(white)(XXXll)2color(white)(mmm)3color(white)(mmmmll)3
The ratio is not in small whole numbers, so we multiply by integers until the ratio comes close to small whole numbers.
The ratio comes out as "Al:C"= 4:3.
Thus, the empirical formula is "Al"_4"C"_3.