Hello dear Mathematics users,
Is there an elegant method for separating a vector into two vectors, one diagonal and the other collinear to either the x or the y axis, so that the sum of their magnitudes would be as low as possible? Eg, separating (3,2) to (2,2) and (1,0)?
Context: I'm working on a personal programming project. I'm sure I could achieve this with a quick and dirty code kludge, but that would feel... dissatisfying. I'm trying to avoid conditional logic for optimization purposes.