A detergent is a cleaning agent that works by reducing surface tension and emulsifying oils, allowing water to wash away dirt and grease. Unlike soap (which is a specific type of detergent made from fats), detergents are synthetic compounds that work effectively in hard water.