Let x = the number of books Dimitrius started with (before last week)
He returned 3 books this week, leaving him with x-3 books.
Then he checks out 8 new books, so he now has (x-3) + 8 = x + 5 books
He now has 12 library books:
x+5 = 12
Subtract 5 from both sides:
x = 7 books
Dimitrius started with 7 books
x+5 = 12
Subtract 5 from both sides:
x = 7 books
He had 7 books.