The simultaneous use of linear spatial encoding magnetic fields (L-SEMs) and nonlinear spatial encoding magnetic fields (N-SEMs) in B inhomogeneity problems is formulated and demonstrated with both simulations and experiments. Independent excitation k-space variables for N-SEMs are formulated for the simultaneous use of L-SEMs and N-SEMs by assuming a small tip angle. The formulation shows that, when N-SEMs are considered as an independent excitation k-space variable, numerous different k-space trajectories and frequency weightings differing in dimension, length, and energy can be designed for a given target transverse magnetization distribution. The advantage of simultaneous use of L-SEMs and N-SEMs is demonstrated by B inhomogeneity correction with spoke excitation. To fully utilize the independent k-space formulations, global optimizations are performed for 1D, 2D RF power limited, and 2D RF power unlimited simulations and experiments. Three different cases are compared: L-SEMs alone, N-SEMs alone, and both used simultaneously. In all cases, the simultaneous use of L-SEMs and N-SEMs leads to a decreased standard deviation in the ROI compared with using only L-SEMs or N-SEMs. The simultaneous use of L-SEMs and N-SEMs results in better B inhomogeneity correction than using only L-SEMs or N-SEMs due to the increased number of degrees of freedom.