If you have an idea for an invention, before you patent it you should check to see if it's already been invented by some other inventor in the past. Though actually, whether or not it's been invented, what you'll want to do is find out whether it's been patented before with the USPTO (the United States Patent and Trademark Office). Here you'll learn how to search patents to find out if your invention idea is already patented or if you should redirect your brainstorming to another invention idea.
If you live near Alexandria, Virginia, visit the United States Patent and Trademark Office. The USPTO facility has print archives of patents filed in the US as far back as 1790.
Check at your local library for a collection for microfilm containing all previous patents filed. Ask for help with the Reference department. Some libraries are Patent and Trademark Depository Libraries and keep in their holdings in microfilm or optical disc format.
Go online to the USPTO website, where you can search the database for patents that were granted by the Patent and Trademark Office since 1976. Or do a Google search only for patents - which many people don't realize can be done - where you can optionally use advanced search options limiting your results by such things as inventors and patent dates. See the Resources section for the links.
Wherever you search, to definitively find out if your invention idea is already patented, be creative with your patent search terms. What you call your invention idea may not be what it was called when it was patented. Look for variations on your idea as well as your specific idea, and check to see if there is a use (usage or utility) patent, also.