It is amusing that there are two idioms related to dessert which both mean that something is easy. The first idiom is the one you are asking about, "a piece of cake." The second is "as easy as pie." Example: "For some people, math is a piece of cake." And: "For some people, math is easy as pie." Both idioms mean the same thing: For some people, math is easy.