Label curves on the graph with their mathematical expression?

Clear[var, expr, blah, g, derivatives];
var = Input[“Type a variable, such as x, in this window.”];
expr = Input[ “Type an expression to be differentiated in the variable you just typed in the last window.”];
g[blah_] = expr /. {var → blah};
derivatives := {g[var], g’[var]}
Plot[{derivatives}, {x, -3, 5}, {PlotLabel → “A function and its Derivative”,
PlotLabel → Automatic, PlotRange → All}]

All I’m trying to do is label my curves on the graph as whatever that curve is, such as the function “2x^2” and then I want the derivative to be labeled also, so “4x”..And I mean labeled on the actual curves, not the legend on the side (I know how to do that).. It appears my PlotLabel and PlotRange aren’t doing anything at all. Do I have to be more specific in PlotLabel? I thought of extracting each element such as derivative[[1]] for the function and derivative[[2]] for the actual derivative and then naming those somehow… I feel like I’m missing something easy.

Ok good news. I figured out PlotRange.. I changed it to:

PlotRange -> {-10,10}

I knew it was something easy..Now what about these damn labels on the actual curves??

I do see I use “PlotLabels” twice…For my actual title of the plot output, should I be using a different command to label the cur

If you have Mathematica 11 you can try Callout:

var = Input["Type a variable, such as x, in this window."];
expr = Input[
   "Type an expression to be differentiated in the variable you just \
typed in the last window."];
g[blah_] = expr /. {var -> blah};
derivatives := {Callout[g[var], "function"], 
  Callout[g'[var], "derivative"]}
Plot[Evaluate@derivatives, {x, -3, 5}, 
 PlotLabel -> "A function and its Derivative", PlotRange -> 10]

You may consider Tooltip and Legended too.

Gianluca,
I got the impression that the original poster wants the curves to be labeld by the functions itself. Not just “function” and “derivative”. So this a simple variation of your solution:

var = Input["Type a variable, such as x, in this window."];
expr = Input[
   "Type an expression to be differentiated in the variable you just typed in the last window."];
g[blah_] = expr /. {var -> blah};
derivatives := {Callout[g[var], g[var], Above], Callout[g'[var], g'[var], Above]};
Plot[
 	Evaluate@derivatives, {x, -3, 5},
 	PlotLabel -> "A function and its Derivative", PlotRange -> 20
 ]

I increased the plot range, so as not to crowd the function labels

Callout documentation

Another one. Uses the Plot option PlotLabels. Instead of the function wrappers Callout or Labeled.

var = Input["Type a variable, such as x, in this window."];
expr = Input[
   "Type an expression to be differentiated in the variable you just typed in the last window."];
g[blah_] = expr /. var -> blah;
derivatives = {g[var], g'[var]};
Plot[
 	Evaluate@derivatives, {x, -3, 5},
 	PlotLabel -> "A function and its Derivative",
 	PlotLabels -> Placed["Expressions", Above],
 	PlotRange -> 20
 ]