The first location (on the left) will hold one of the 7 math books.
The last location (on the far right) will hold one of the remaining 6 math books.
The middle location (location 6) will hold one of the four history books.
There are 8 books remaining.
In location #2 (from the left), place one of the 8 remaining books.
In location #3, place one of the 7 remaining books.
In location #4, place one of the 6 remaining books.
In location #5, place one of the 5 remaining books.
Location #6 is filled with the previously chosen history book.
In location #7, place one of the 4 remaining books.
In location #8, place one of the 3 remaining books.
In location #9, place one of the 2 remaining books.
In location #10, place the last book.
To find the total number of possibilities, multiply these numbers together:
7 x 8 x 7 x 6 x 5 x 4 x 4 x 3 x 2 x 1 x 6