The ideal efficiency of any engine is that which matches the Carnot cycle.
Using Carnot's equation of ideal efficiency,
`eta=` `1 - T_l/T_h` where, `T_l ` is the absolute temperature of the cold reservoir and `T_h` is the absolute temperature of the hot reservoir.
Here, `T_l=300 K` ; `T_h=500 K`
Hence, `eta = 1 - 300/500`
`=0.4 or 40%.`
Therefore, the ideal efficiency of the heat engine is 40%.