As said in the comments the difference here is definite vs indefinite articles. Here is a link with more details:
Specific v Non specific
"The house has a blue door."
This is an indefinite article. Its just a non-specific blue door. there are lots of blue doors in the world and we don't really care particularly which one it is.
"The house has the blue door."
This is a definite article. This is the particular blue door we care about. Probably there is only one house with a blue door here so we can use that defining feature to call it out specifically
"meet me at a corner with a tree"
you could go to any corner with any tree and get very lost
"meet me at the corner with the tree"
You know very specifically where you are to meet
Plurality and Countability
Another rule we have about articles is that only singular, countable nouns can take indefinite articles. plural or uncountable nouns take a definite article or no article at all. Another link: https://www.ef.edu/english-resources/english-grammar/countable-and-uncountable-nouns/
When can an article be omitted?
you can say "a book" or "the book" but you can't say "a books"
you can say "a grain" or "the grain" but you can't say "a rice"*
"She has the eyes of a lynx."
Here "eyes" is plural so we have to use the definite article "the"
if we made it singular we could say either
"She has the eye of a lynx."
"She has an eye of a lynx."
The first indicates the "eye of a lynx" is a known concept or item. This is how we generally format metaphors ("the voice of an angle" "the eye of a hawk" "the strength of an ox") or perhaps its a specific very special magical eyeball that she possesses
The second indicates the eye is perhaps one among many, just any old eye of a lynx. This sounds more like she has a physical lynx eyeball in her possession.
"She has the books from the class"
-> She has the collective specific books from the class
"She has books from the class"
-> She has the collective, slightly less specific books from the class
"She has the book from the class"
-> She has the one specific book from the class
"She has a book from the class"
-> She has any random old book from the class
For the last sentence, "The line has slope 2." we've left out the article for slope all together but used the definite article for line. (Personally I would say that the omission of the article here is more of a mathematical/technical convention rather than something dictated by standard conversational grammar) We could rewrite this sentence a few different ways:
"The slope of the line is 2"
We are talking about that one specific slope and that one specific line
"The line has a slope of 2"
We are not specific because there are any number of slopes we could pick from and we just happened to pick 2
"A line has the slope of 2"
There exists somewhere a non-specific line which has the specific slope of 2
*you could perhaps say "a rice please" in ordering at a restaurant but this is different because "a rice" now refers to the distinct item, not the collection of rice grains