Linear equations and patterns