This question already has an answer here:
This image that i'm working on in cycles render is almost done but I stuck at the part of the block behind the cubes. It has a shadow on the white plane. The only thing that's wrong is that I don't want the plane to show up. Only the shadow. In "film" I already set the Transparent to "true" and in the compositing I did the thing with using only that layer and than substract and invert and all of that. But I can't seem to find any solutions. It's a movie clip so the compositing is more than just that.