There are several different issues you need to take into account while writing your essay. The first is that both patent and copyright follow distinct national legal traditions, and that the precise definitions will vary depending on the nation or region under consideration.
The first element you might want to cover in your essay is the definition of three crucial terms, algorithm, source code, and object code, as most relevant legal decisions have focused on the difference between algorithms and their tangible expressions.
In the United States, several Supreme Court decisions, most importantly CLS Bank International v. Alice Corp., have argued that neither algorithms nor software in general conform the the requirements for patentability, but that “an inventive concept” is required. Instead, software is normally copyrighted rather than patented, and copyright protection will be the most important part of your essay.
For software protections, Apple v. Franklin decided that source and object code both fall under copyright. The complex grey area is "nonliteral elements", in other words if you were, for example, to take existing source code and make minor changes to a few individual lines of code, but kept the sequence and logic intact. The Digital Millennium Copyright Act (DMCA) makes evasion of copy protection (and piracy) illegal.
Proprietary software falls under the concept of a trade secret, but this would apply to software used internally within a company rather than software programs sold to the public.
Note that for help on additional questions, you need to post separate Q&As.