purely magnetic Attitude Control System (ACS), utilizing only magnetorquers, on a satellite in low Earth orbit is an underactuated system. The control torque is limited to an S1 sphere, such that the S1 sphere is always perpendicular to the local magnetic field. Since the local magnetic field is a relatively wellknown function of the orbital position, attitude and time, the directions of the under actuation can be estimated beforehand. This study demonstrates ways to generate attitude trajectories while minimizing the control effort, assuming the final desired point is within the reachable set of the system dynamics and the time horizon. Such trajectories are generated by discretizing the state space and obtaining the optimal paths between any two reachable states, and then solving the Bellman equation, composing a set of optimal paths to obtain the final trajectory. The optimal paths between the discretized points can be determined beforehand, thereby only requiring the Bellman equation to be solved, consequently providing speed benefits over traditional methods. The proposed dynamic programming based solutions are presented for attitude trajectories for the upcoming CubeSat missions flying on the University of Illinois' IlliniSat-2 CubeSat bus, which uses a purely magnetic attitude determination and control system.