>>19012236 (OP)Foam is formed by trapping gas bubbles in a liquid or solid, typically with the help of surfactants that reduce surface tension and stabilize the bubbles. This process involves mixing air with the liquid or solid while applying mechanical work, allowing the gas to disperse and create a cellular structure.