Bacteria are constantly faced with a diverse and changing antigen environment. Thus, it is necessary for the bacteria to organize their immunity such that they can optimally defend against the environment. The goal of this project was to create a mathematical model that captures the dynamics of CRISPR immunity, a form of adaptive immunity, in bacterial populations. Aspects of CRISPR systems are still unknown and by creating a model, we hope to learn more about the details of the system. I began by reading the literature on mathematical models for immunity and papers on the biology of CRISPR immunity. The project then transitioned into mathematical modeling motivated by the biology of the system, where analysis and optimization were the primary tools used. Ultimately, I created a theoretical framework to infer the behaviors of various CRISPR systems. During this project, I learned a lot about modeling complex systems and I have a better idea of how to gauge the difficulty of a problem. Learning to do this helped me navigate how to proceed in the project and helped motivate some of the methods used. This compliments my education because I want to pursue a math PhD, and working on this project gave me insight into how many mathematical principles are applied to solve problems. Reading the literature in this field also let me see how advanced mathematics is used in various projects. The knowledge and experience I have gained working on this project will help me in furthering my education and in future research projects.